#include <stdio.h>
int main(void)
{
  int n, i, soeji;
  long long int k;
  int town[100000];
  scanf("%d%lld", &n, &k);
  for (i = 1; i <= n; i ++)
    scanf("%d", &town[i]);
  
  i = 1;
  while(k){
      soeji = town[i];
      i = soeji;
      k--;
  }
  printf("%d", soeji);
  return 0;
}