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
def increasing(tab):
    for i in range(1, len(tab)):
        if tab[i] <= tab[i-1]:
            return i - 1
    return -1


def case4(tab, pos, k):
    print("TAK")
    left = [str(i + 1) for i in range(max(pos - k, 0, pos + 1))]
    ile = k - 1 - pos + 1
    right = []
    if ile:
        right = [str(i + 1) for i in range(pos + 1, pos + 1 + ile)]
    print(" ".join(left + right))


def case2(tab):
    suf_max = tab[:]
    for i in range(len(tab) - 2, 0, -1):
        suf_max[i] = max(suf_max[i], suf_max[i + 1])
    cur_min = tab[0]
    for i in range(len(tab) - 1):
        cur_min = min(cur_min, tab[i])
        if cur_min >= suf_max[i + 1]:
            print("TAK")
            print(str(i + 1))
            return
    print("NIE")


def case3(tab):
    pos = 0
    for i in range(1, len(tab)):
        if tab[i] > tab[pos]:
            pos = i
    if pos == 0:
        print("TAK")
        print("1 2")
    elif pos < len(tab) - 1:
        print("TAK")
        print(str(pos)+" "+str(pos + 1))
    else:
        cur_min = tab[0]
        for i in range(len(tab) - 2):
            cur_min = min(tab[0], cur_min)
            if not (cur_min < tab[i + 1] < tab[pos]):
                print("TAK")
                print(str(i + 1) + " " + str(i + 2))
                return
        print("NIE")


def solve(tab, k):
    pos = increasing(tab)
    if pos < 0:
        print("NIE")
        return
    if k >= 4:
        case4(tab, pos, k - 1)
    elif k == 3:
        case3(tab)
    else:
        case2(tab)


g = input().split(" ")
line = [int(x) for x in input().split(" ")]
solve(line, int(g[1]))