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
import sys


def three(no, arr):
    cur_min = arr[0]
    for i in range(1, no):
        if arr[i] <= cur_min:
            return i
    cur_max = arr[no - 1]
    for i in range(no - 2, 0, -1):
        if arr[i] >= cur_max:
            return i
    return -1


def four(no, arr):
    for i in range(1, no):
        if arr[i - 1] >= arr[i]:
            return i
    return -1


n, k = (int(i) for i in sys.stdin.readline().split())
a = [int(i) for i in sys.stdin.readline().split()]

if k == 2:
    min_till = [10 ** 9 + 1]
    max_from = [0]
    for i in range(n):
        min_till.append(min(min_till[i], a[i]))
        max_from.append(max(max_from[i], a[n - 1 - i]))
    max_from.reverse()
    for i in range(1, n):
        if min_till[i] >= max_from[i]:
            print("TAK")
            print(i)
            break
    else:
        print("NIE")
elif k == 3:
    b = three(n, a)
    if b < 0:
        print("NIE")
    elif b == 0:
        print("TAK")
        print(1, 2)
    elif b == n - 1:
        print("TAK")
        print(n - 2, n - 1)
    else:
        print("TAK")
        print(b, b + 1)
else:
    b = four(n, a)
    if b < 0:
        print("NIE")
    else:
        lower_bound = b-1
        upper_bound = b+k-2
        upper_bound += max(0, 1 - lower_bound)
        lower_bound += max(0, 1 - lower_bound)
        lower_bound -= max(0, upper_bound - n)
        upper_bound -= max(0, upper_bound - n)
        solution = list(range(lower_bound, upper_bound))
        print("TAK")
        print(' '.join([str(i) for i in solution]))