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
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
const int LIM=5e5+7, INF=1e9+7;
int T[LIM], mi[LIM], ma[LIM], ans[LIM], n, k;
bool check2() {
  rep(i, n) {
    mi[i]=T[i];
    if(i) mi[i]=min(mi[i], mi[i-1]);
  }
  for(int i=n-1; i>=0; --i) {
    ma[i]=T[i];
    if(i<n-1) ma[i]=max(ma[i], ma[i+1]);
  }
  rep(i, n-1) if(mi[i]>=ma[i+1]) {
    ans[i+1]=1;
    return true;
  }
  return false;
}
bool check3() {
  int ma=-INF, mi=INF;
  rep(i, n) {
    ma=max(ma, T[i]);
    mi=min(mi, T[i]);
  }
  rep(i, n-2) if(T[i+1]==ma || T[i+1]==mi) {
    ans[i+1]=ans[i+2]=1;
    return true;
  }
  return false;
}
bool check4() {
  rep(i, n-2) if(T[i]>=T[i+1]) {
    ans[i]=ans[i+1]=ans[i+2]=1;
    return true;
  }
  return false;
}
void wypisz() {
  rep(i, n) if(ans[i]) --k;
  rep(i, n) if(k && !ans[i]) {
    ans[i]=1;
    --k;
  }
  cout << "TAK\n";
  rep(i, n-1) if(ans[i+1]) cout << i+1 << " ";
  cout << '\n';
}
int main() {
  ios_base::sync_with_stdio(0); cin.tie(0);
  cin >> n >> k;
  rep(i, n) cin >> T[i];
  ans[0]=1;
  if(check2()) wypisz();
  else if(k>=3 && check3()) wypisz();
  else if(k>=4 && check4()) wypisz();
  else cout << "NIE\n";
}