#include <stdio.h>

typedef long long ll;

int main(void) {
  int n;
  ll k;
  scanf("%d %lld", &n, &k);
  int a[200001] = {0}, b[20001] = {0};
  for(int i = 1;i <= n;i++) {
    scanf("%d", a + i);
  }
  int start = 0;
  int current = 1;
  while(b[current] == 0) {
    b[current]++;
    current = a[current];
    start++;
  }
  long loop = 0;
  while(b[current] < 2) {
    b[current]++;
    current = a[current];
    loop++;
  }
  if(k < start) {
    current = 1;
    for(int i = 0;i < k;i++) {
      current = a[current];
    }
    printf("%d\n", current);
    return 0;
  }
  long ret = (k - start) % loop;
  for(long i = 0;i < ret;i++) {
    current = a[current];
  }
  printf("%d\n", current);
}