#include <stdio.h>
#include <stdint.h>

int main(void){
  long int n;
  unsigned long int k;
  long int a[200000];
  
  scanf("%ld",&n);
  scanf("%ld",&k);
  
  for(long int i=0;i<n;i++){
  	scanf("%ld",&a[i]);
  }
  
  long int state=0;
  
  for(long int i=0;i<k;i++){
    //printf("%ld→",state+1);
  	state=a[state]-1;
  }
  printf("%ld",state+1);
  	return 0;
}