#include <stdio.h>

int main(){
  long long int N,i;
  long long int K,stay=0;
  scanf("%lld %lld",&N,&K);
  long long int teleport[N];
  for(i = 0; i<N; i++){
	scanf("%lld",&teleport[i]);
    teleport[i] = teleport[i] - 1;
  }
  long long int town,Count = 1;
  for(i=0;i<K;i++){
    stay = teleport[stay];
    if(stay == 0){
	  break;
    }
    Count++;
  }
  for(i = K%Count;i>0;i--){
     stay = teleport[stay];
  }
  printf("%lld",stay + 1);
  return 0;
}
