#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main(){
  long N, A[200010] ,  ans = 1;
  long long K, i;
  scanf("%ld %lld", &N, &K);
  for (long i = 0; i < N; i++) scanf("%ld", A + i);
  for (long long i = 0; i < (K % N); i++) {
    ans = A[ans - 1];
  }
  printf("%ld", ans);
  return 0;
}
