1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
n, k = map(int, input().split())
l = list(map(int, input().split()))

kk = k

if k >= 4:
    b = [0] * (n + 10)
    
    for i in range(n - 1):
        if l[i + 1] <= l[i]:
            b[i] = 1
            b[i + 1] = 1
            k -= 2
            
            if i:
                b[i - 1] = 1
                k -= 1
            break
                
    else:
        print('NIE')
        exit()


    o = []
    
    for i in range(n):
        if k > 1 and b[i] == 0:
            k -= 1
            b[i] = 1

        if b[i]:
            o.append(i + 1)

    assert len(o) == kk - 1
    
    print('TAK')
    print(' '.join(map(str, o)))
elif k == 3:
    for i in range(1, n - 1):
        if l[i] <= l[0]:
            print('TAK')
            print(i, i + 1)
            exit()

    for i in range(n - 2, 0, -1):
        if l[i] >= l[-1]:
            print('TAK')
            print(i, i + 1)
            exit()

    print('NIE')
else:
    assert k == 2

    mins = [l[0]]
    for i in range(1, n - 1):
        mins.append(min(mins[i - 1], l[i]))

    maxs = [l[-1]]
    for i in range(n - 1, -1, -1):
        maxs.append(max(maxs[-1], l[i]))
    
    maxs.reverse()

    for i in range(n - 1):
        if mins[i] >= maxs[i + 1]:
            print('TAK')
            print(i + 1)
            exit()

    print('NIE')