#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
	int N;
	ll K;
	cin >> N >> K;
	vector<int> A(N);
	for (auto& x : A) { cin >> x; -- x; }
	int pos = 0;
	vector<int> a(N, -1);
	bool flag = true;
	for (int t = 0; K > 0; ++ t) {
		if (flag && a[pos] >= 0) {
			int x = t-a[pos];
			K -= (K-1)/x*x;
			flag = false;
		} else {
			a[pos] = t;
		}
		pos = A[pos];
		-- K;
	}
	cout << pos+1 << endl;
}
