#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn=2e5+5;
ll k,n,a[maxn],r[maxn],b[maxn];
ll be,len,p=1,cnt;
int main()
{
cin>>n>>k;
for(int i=1;i<=n;i++)
cin>>a[i];
while(1)
{
	if(b[a[p]]!=0)
	{
		be=b[a[p]];
		len=cnt-be+1;
		break;
	}
	r[++cnt]=a[p];
	b[a[p]]=cnt;
	p=a[p];
}
if(k<=be)
cout<<r[k];
else
{
	int s=(k-be)%len;
	cout<<r[be+s];
}
return 0;

}