#include <iostream>
#include <vector>

using namespace std;

int main() {
	long long n, k; cin >> n >> k;
	vector<int> a(n);
	for (auto& e : a) cin >> e, --e;
	vector<int> flag(n);
	int cnt = 0, now = 0;
	while (true) {
		++cnt;
		if (flag[now]) break;
		flag[now] = cnt;
		now = a[now];
	}
	if (k >= flag[now] - 1) {
		k -= flag[now] - 1;
		k %= cnt - flag[now];
	} else now = 0;
	while (k--) now = a[now];
	cout << now + 1 << endl;

	return 0;
}