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

const int N = 2e5 + 5;
int A[N], n;
long long k;
bool v[N];

signed main() {
	ios::sync_with_stdio(0);
	cin >> n >> k;
	for (int i = 1; i <= n; i++)
		cin >> A[i];
	int x = 1;
	while (!v[x])  {
		k--, v[x] = 1, x = A[x];
		if (!k) cout << x << endl, exit(0);
	}
	int s = x;
	int c = 0;
	while (++c, (x = A[x]) != s);
	k %= c;
	while (k--) x = A[x];
	cout << x << endl;
}