#include<stdio.h>
int main(void)
{
  int N,i,j,x,y,MOD,A[200000]={0},check[200000]={},move[200000]={0};
  long long K;
  x=scanf("%d %lld",&N,&K);
  for(i=0;i<N;i++)x=scanf("%d",&A[i]),check[i]=-1;
  for(i=0,j=0;;i=A[i]-1,j++)if(check[i]<0)check[i]=j,move[j]=i;else{x=j,y=check[i],MOD=x-y;break;}
  if(K>=x)K=(K-y)%MOD+y;
  return printf("%d\n",move[K]+1),0;
}