#include <stdio.h>

int main(){
  unsigned long long int n,k,i,temp,count=0,ans=0,place=1;
  scanf("%lu %lu",&n,&k);
  unsigned long long int a[n];
  unsigned long long int asum[n];
  for(i=0;i<n;i++){
    scanf("%lu",&a[i]);
  }
  for(i=0;i<n;i++){
    asum[i]=0;
  }
  temp=k;
  for(i=0;i<temp;i++){
    if(asum[place-1]!=0){
      ans=k%count;
      break;
    }
    asum[place-1]++;
    place=a[place-1];
    count++;
  }
  place=1;
  for(i=0;i<ans;i++){
    place=a[place-1];
  }
  printf("%lu\n",place);
  return 0;
}