#include <stdio.h>

int main(){
  int n,i,j,m,a[200005],b[200005],c=1,d[200005];
  long k;
  scanf("%d",&n);
  scanf("%ld",&k);
  for(i=0;i<n;i++){
    scanf("%d",&c);
    a[i]=c-1;
    d[i]=0;
  }
  b[0]=0;
  d[0]=1;
  for(i=a[0];d[i]==0;i=a[i]){
    b[c]=i;
    d[c]=1;
    c++;
  }
  c=1;
  m=i;
  for(i=a[i];i!=m;i=a[i]){
    d[c]=i;
    c++;
  }
  if(k>m){
    printf("%d",d[(k-m)%c]+1);
  }else{
    printf("%d",b[k]+1);
  }
  return(0);
}