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

ll N, K;


int main(){
	cin >> N >> K;
	vector<int> A(N+1);
	vector<int> last_visit_step(N+1);
	
	for ( int i = 1; i <= N; i++ ){
		cin >> A[i];
	}
	
	int pos = 1;
	for ( int step = 1; step <= K; step++ ){
		pos = A[pos];
		if ( last_visit_step[pos] ){
			ll period = step - last_visit_step[pos];
			K -= ((K-step)/period)*period;
		}
		last_visit_step[pos] = step;
	}
	
	cout << pos << endl;
	
	return 0;
}

