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

int main()
{
	long long N, K;
	cin >> N >> K;
	vector<int> A( N );
	for( int i = 0; i < N; i++ ) {
		cin >> A[i];
	}

	int l = 0;
	int c = 1;
	int v = 1;
	vector<int> a( N + 1, -1 );
	vector<int> s;
	while( a[v] < 0 ) {
		a[v] = s.size();
		s.push_back( v );
		v = A[v - 1];
	}
	c = s.size() - a[v];
	l = a[v];
	int ans;
	if( K < l ) ans = s[K];
	else ans = s[l + (K - l) % c];

	cout << ans << endl;
}
