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

typedef long long ll;

int main(){
  int n;
  int i,j,now,t;
  ll k;
  int sum1,sum2;
  int a[200006];
  int v[200006];

  scanf("%d %lld", &n, &k);

  for(i = 1;i <= n;i++){
    scanf("%d", &a[i]);
    v[i] = 0;
  }

  v[1] = 1;
  now = 1;
  sum1 = 0;

  while(1){
    if(v[a[now]] == 1){
      t = a[now];
      sum1++;
      break;
    }

    else{
      v[a[now]] = 1;
      now = a[now];
      sum1++;
    }
  }

  sum2 = 0;
  now = 1;
  while(t != now){
    sum2++;
    now = a[now];
  }

  sum1 = sum1 - sum2;
  k = k - sum2;
  k = k % sum1;

  now = t;
  while(k){
    now = a[now];
    k--;
  }

  printf("%d\n", now);

  return 0;
}