#include <iostream>

using namespace std;

int te[200000],vi[200000],po[200000];
long long k;

int vis(int ac, int c){
	vi[ac]=c;
	po[c] = ac;
	if(c==k+1)return ac+1;
	if(vi[te[ac]]){
		k-=(vi[te[ac]]-1);
		k%=(c-vi[te[ac]]+1);
		return po[vi[te[ac]]+k]+1;
	}
	return vis(te[ac],c+1);
}
int main(){
	
	cin.tie(0); ios_base::sync_with_stdio(0);
	int n;
	cin>>n>>k;
	for(int i=0;i<n;i++){
		int a;
		cin>>a;
		a--;
		te[i] = a;
	}
	cout<<vis(0,1)<<endl;
	
	return 0;
}