#include <stdio.h>  /*入出力*/
#include <stdlib.h> /*標準ライブラリ*/
#include <string.h> /*文字列*/
#include <math.h>   /*計算*/
#include <assert.h> /*確認*/
#include <ctype.h>  /*文字操作*/
#include <stdbool.h>/*bool型*/
#include <limits.h>/*限界*/
//---------------------------------------------------
#define rep(i, n) for(int  i = 0; i < (n); i++)
#define ABS(a) (((a)>(0))?a:-(a))
#define LL long long
#define MOD 1000000007//10^9+7(素数)
//---------------------------------------------------
LL max(LL a, LL b){
  if (a > b) {
    return a;
  }else return b;
}

int main(void)
{
  LL n;
  LL k;
  LL a[200010] = {0};
  LL visit[20010] = {0};
  LL work;
  LL ans = 0;

  scanf("%lld %lld", &n, &k);
  for (LL i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
  }

  //roop
  ans = 1;
  LL loop = 0;
  LL way = 0;
  int flag = 0;

  for (size_t i = 0; i <= n+2; i++) {
    loop++;
    ans = a[ans];

    if (visit[ans] != 0 ) {
      way = visit[ans];
      loop = loop - visit[ans];
      break;
    }

    if (ans == 1) {
      break;
    }

    visit[ans] = loop;
  }

  k = (k-way) % loop;
  while (k>0) {
    ans = a[ans];
    k--;
  }

  printf("%lld\n", ans);
  return 0;
}
