#include<stdio.h>
int main(void){
  int n;
  scanf("%d",&n);
  long long k;
  scanf("%lld",&k);
  int a[n],b[n];
  for(int i=0;i<n;i++){
	scanf("%d",&a[i]);
    b[i]=0;
  }
  b[0]=1;
  int count=1,i=0,c[n];//移動の軌跡
  c[0]=1;
  while(count<=n){
     //printf("%d番目の街は%d\t",count,a[i]);
    c[count++]=a[i];
    b[a[i]-1]++;
     ///printf("%d回目\n",b[a[i]-1]);
    if(b[a[i]-1]==2)break;
     i=a[i]-1;
  }
  count--;
  int T=0;
  i=count;
 while(1){T++;
          i--;
          if(c[count]==c[i])break;
         }
   int kato=i;
 // printf("%d %d\n",T,kato);
 // printf("%d\n",(k-kato)%T);
  int pattern[n];
  
  for(int i=kato;i<count;i++){
	pattern[i-kato]=c[i];
   // printf("%d ",pattern[i-kato]);
  }
  if((k-kato)%T>=0)
  printf("%d",pattern[(k-kato)%T]);
  else printf("%d",c[k]);
  return 0;
}