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

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;

int main(void) {
  int scan; // scanf result
  ull n; // to input 
  ull k; // to input 
  ull *a;

  scan = scanf("%llu", &n);
  scan = scanf("%llu", &k);
  a = (ull *)malloc(sizeof(ull) * n);
  for (ull i = 0; i < n; i++) {
    scan = scanf("%llu", &a[i]);
  }

  /*
  ull *position;
  position = (ull *)malloc(sizeof(ull) * (k + 1));
  position[0] = 1;
  ull p;
  for (ull j = 1; j <= k; j++) {
    p = position[j - 1];
    position[j] = a[p - 1];
  }
  printf("%llu", position[k]);
  */
  ull position;
  position = 1;
  ull p;
  ull *loop;
  loop = (ull *)malloc(sizeof(ull) * 100000);
  loop[0] = position;
  for (ull j = 1; j <= k; j++) {
    p = position;
    position = a[p - 1];
    loop[j] = position; 
    for (ull x = 0; x <= j; x++) {
      if (j >= 2 && loop[x] == loop[j]) {
        k = k % (j - 1);
        for (ull e = 1; e <= k; e++) {
          p = position;
          position = a[p - 1];
        }
        printf("%llu", position);
        return (0);
      }
    }
  }
  printf("%llu", position);
  return (0);
}
