/// ****** Property of vipulks ****** \

#include <stdio.h>
#include <limits.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#define ll long long

int main(){
	ll t,n,i,j,k;
	t=1;//scanf("%lld",&t);
	while(t--){
		scanf("%lld%lld",&n,&k);
		ll a[n+2],b[n+2];
		for(i=1;i<=n;i++)
			scanf("%lld",&a[i]);
		b[0]=1;
		for(i=1;i<=n;i++){
			if(a[b[i-1]]==1)
				break;
			b[i]=a[b[i-1]];
		}
		//for(j=0;j<i;j++)
		//	printf("%lld?",b[j]);
		ll rem=k%i;
		printf("%lld\n",b[rem]);
	}
	return 0;
}