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
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
// #pragma GCC optimize("O3")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define pb push_back
#define debug(x) cout << #x << " " << x << endl
#define all(x) x.begin(),x.end()
#define ll long long
#define vi vector<int>
#define vvi vector<vi>
#define vvvi vector<vvi>
#define vll vector<ll>
#define vvll vector<vll>
#define ld long double
#define ull unsigned long long
#define vull vector<ull>
#define fi first
#define se second
#define PII pair<int,int>
#define vPII vector<PII>
#define getunique(v) {sort(v.begin(), v.end()); v.erase(unique(v.begin(), v.end()), v.end());}
#define int128 __int128

int tab[1000005];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
	cout << setprecision(16) << fixed;
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
    int tt = 1;
    // cin >> tt;
    while(tt--) {
		int n,k; cin >> n >> k;
		vi a(n); rep(i,n) cin >> a[i];
		int ros = 1;
		rep(i,n-1) if(a[i+1] <= a[i]) ros = 0;
		if(ros){
			cout << "NIE";
			return 0;
		}
		int kon[n];
		memset(kon,0,sizeof(kon));
		int ile = 0;
		kon[n-1] = 1;
		if(k >= 4){
			if(a[0] < a[1]){
				kon[0] = kon[1] = 1;;
			}else{
				for(int i = 1; i < n; i++){
					if(a[i] < a[i+1]){
						kon[i-1] = kon[i] = kon[i+1] = 1;
						break;
					}
				}
			}
		}
		else if(k == 3){
			int mini = *min_element(all(a));
			int maks = *max_element(all(a));
			int ok = 0;
			for(int i = 1; i < n; i++){
				if(a[i] == mini or a[i] == maks){
					ok = 1;
					kon[i] = kon[i-1] = 1;
					break;
				}
			}
			if(!ok){
				cout << "NIE";
				return 0;
			}
		}
		else if(k == 2){
			int mini[n];
			mini[0] = a[0];
			for(int i = 1; i < n; i++){
				mini[i] = min(mini[i-1], a[i]);
			}
			int maks[n];
			maks[n-1] = a[n-1];
			for(int i = n-2; i >= 0; i--){
				maks[i] = max(maks[i+1], a[i]);
			}
			int ok = 0;
			rep(i,n-1){
				if(mini[i] >= maks[i+1]){
					ok = 1;
					kon[i] = 1;
					break;
				}
			}
			if(!ok){
				cout << "NIE";
				return 0;
			}
		}
		rep(i,n) ile += kon[i];
		rep(i,n){
			if(ile == k) break;
			if(kon[i] == 0){
				kon[i] = 1;
				ile++;
			}
		}
		cout << "TAK\n";
		rep(i,n-1){
			if(kon[i]) cout << i+1 << " ";
		}
    }
}