#include<stdio.h>
int main(void){
  long long  int n,k,a[200001],i,j,b,c,p[200001],q[200001],d,e;
  scanf("%lld %lld",&n,&k);
  for(i=1;i<=n;i++){
    scanf("%lld",&a[i]);
  }
  p[0]=1;
  q[1]=1;
  for(i=1;i<=n;i++){
    p[i]=a[p[i-1]];
    /*printf("%lld\t",p[i]);*/
    q[p[i]]++;
    if(q[p[i]]==2){
      b=i;
      d=p[i];
      break;
    }
  }
  for(i=0;i<b;i++){
    if(p[i]==d){
      e=i;
      break;
    }
  }
  c=(k-e)%(b-e);
  /*printf("%lld %lld %lld %lld\n",b,c,d,e);*/
  printf("%lld\n",p[c+e]);
  return 0;
}

