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

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


