#include <stdio.h>
long long int search(long long int num,long long int* p,long long int N){
  for(long long int i = 0; i<N; i++){
	if(num == p[i]){
		return i;
    }
  }
}
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;
  for(i=0;i<K;i++){
    town = teleport[stay];
    stay = town;
  }
  printf("%lld",stay + 1);
  return 0;
}