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
118
119
120
121
122
#include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i = (a); i <= (b); ++i)
#define FORD(i,a,b) for(int i = (a); i >= (b); --i)
#define RI(i,n) FOR(i,1,(n))
#define REP(i,n) FOR(i,0,(n)-1)
#define mini(a,b) a=min(a,b)
#define maxi(a,b) a=max(a,b)
#define pb push_back
#define st first
#define nd second
#define sz(w) (int) w.size()
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<pii, int> para;
const ll inf = 1e18 + 7;
const ll maxN = 1e6 + 5;
const ll MOD = 1e9 + 7;

int n, k, arr[maxN];
vector<int> ans;

bool rosnie() {
	RI(i, n - 1) {
		if (arr[i] <= arr[i - 1]) return false;
	}
	return true;
}

void print_ans() {
	sort(ans.begin(), ans.end());
	for (auto x: ans) cout << x + 1 << " ";
	cout << endl;
}

void solve_4() {
	cout << "TAK\n";
	int which = -1;
	RI(i, n - 1) {
		if (arr[i] <= arr[i - 1]) {
			which = i - 1;
			break;	
		}	
	}
	if (which >= 1) ans.pb(which - 1);
	ans.pb(which);
	if (which != n - 2) ans.pb(which + 1);
	REP(i, n) {
		if (ans.size() == k - 1) break;
		if (abs(i - which) <= 1) continue;
		ans.pb(i);
	}	
}

int last_minim() {
	int minim = MOD;
	int ind = -1;
	FORD(i, n - 1, 0) {
		if (arr[i] < minim) {
			minim = arr[i];
			ind = i;
		}
	}
	return ind;
}

void solve_3() {
	int max_ind = distance(arr, max_element(arr, arr + n));
	int min_ind = last_minim();
	if (max_ind == n - 1 && min_ind == 0) {
		cout << "NIE\n";
		exit(0);
	}
	cout << "TAK\n";
	if (max_ind != n - 1) {
		ans.pb(max_ind - 1);
		ans.pb(max_ind);
		return;
	}
	if (min_ind != 0) {
		ans.pb(min_ind - 1);
		ans.pb(min_ind);
	}
}

void solve_2() {
	vector<int> maxim(n);
	maxim[n - 1] = arr[n - 1];
	FORD(i, n - 2, 0) {
		maxim[i] = max(arr[i], maxim[i + 1]);
	}
	int minim = MOD;
	REP(i, n - 1) {
		minim = min(minim, arr[i]);
		if (minim >= maxim[i + 1]) {
			cout << "TAK\n";
			ans.pb(i);
			return;
		}
	}
	cout << "NIE\n";
	exit(0);
}

int main() {
	cin >> n >> k;
	REP(i, n) cin >> arr[i];
	if (rosnie()) {
		cout << "NIE\n";
		return 0;
	}
	if (k >= 4) solve_4();
	if (k == 3) solve_3();
	if (k == 2) solve_2();
 	print_ans();
	return 0;
}