#include<stdio.h>

int main(){

  int n;
  unsigned long long int k;
  scanf("%d%llu",&n,&k);

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

  int des=1;
  int count=0;
  int memory1,memory2;
  int flag1=0;
  int flag2=0;
  int roopcount[n+1];
  for(int i=0; i<n+1; i++){
    roopcount[i]=0;
  }

  for(long long int i=0; i<k; i++){
    count++;
    roopcount[a[des]]++;
    if((roopcount[a[des]]==2) && flag1==0){
      memory1 = count;
      flag1 = 1;
    }
    if((roopcount[a[des]]==3) && flag2==0){
      memory2 = count;
      flag2 = 1;
    }

    if(flag1==1 && flag2==1){
      printf("%d",a[memory1-1+k%(memory2-memory1)]);
      return 0;
    }

    des = a[des];
  }

  printf("%d",des);

}