#include <bits/stdc++.h>

using namespace std;

long long n, k, curr = 1, cnt, arr[200005], pre[200005];

int main() {
	cin >> n >> k;
	for (int i = 1; i <= n; i++) cin >> arr[i];
	while (k--) {
		curr = arr[curr];
		if (pre[curr]) k %= cnt - pre[curr];
		pre[curr] = cnt++;
	}
	cout << curr;
}
