#include<stdio.h>

int main(){

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

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

  int des=1;
  int teleport=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;
  }
  roopcount[1]=1;
  int roopcity[n+10];
  roopcity[0]=1;


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

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

    des = a[des];
  }

  printf("%d",des);

}
