/* D - Teleporter */

#include <stdio.h>

int main(void){
  int N, i, A[200000], ans = 1, route[200000], count = 0;
  long long K;
  scanf("%d %lld", &N, &K);
  for(i = 1; i <= N; i++){
    scanf("%d", &A[i]);
  }
  i = 1;
  while(K > 0){
    route[i] = A[ans];
    for(int j = 1; j < i; j++){
      if(route[j] == route[i]){
        // printf("%lld %d %d\n", K, j, i);
        ans = route[j + (K - 1) % (j - i)];
        count++;
        break;
      }
    }
    if(count == 1){
      break;
    }
    ans = route[i];
    K--;
    i++;
  }
  printf("%d\n", ans);
}
