#include <stdio.h>

int main(){
  int N, i;
  unsigned long int K, j;
  int A[200000],B[200000];
  
  scanf("%d %ld",&N,&K);
  for (i = 0; i < N ; i++){
    scanf("%d",&A[i]);
  }
  
  B[0] = 1;
  
  for(j = 1; j <= K ; j++){
    B[j] = A[ B[j-1] - 1];
  }
  
    
  printf("%d",B[K]);
  
  return 0;
  
  
}