#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main(void) {
  int N;
  long K;
  int A[200000];
  int simu[200000];
  int i, j, amari;
  
  scanf("%d %ld", &N, &K);
  for (i = 0; i < N; i++) {
    scanf("%d", &A[i]);
    A[i]--;
  }
  
  simu[0] = 0;
  for (i = 1; i < N; i++) {
    simu[i] = A[simu[i-1]];
    for (j = 0; j < i; j++) {
      if (simu[j] == simu[i]) {
        break;
      }
    }
    if (j < i) break;
  }
    
  amari = (K - (long)j) % (i - j);
  printf("%d\n", simu[j + amari] + 1);
  return(0);
}
