#include <stdio.h>

int main(){
  unsigned long long int n,k,i,place=1;
  scanf("%lu %lu",&n,&k);
  unsigned long long int a[n];
  for(i=0;i<n;i++){
    scanf("%lu",&a[i]);
  }
  for(i=0;i<k;i++){
    place=a[place-1];
  }
  printf("%lu",place);
  return 0;
}
  