#include<stdio.h>
int main(){
	int n,s,ans1=1,ans,cnt=0;
  	long int k;
    scanf("%d %ld",&n,&k);
  	int a[n];
	for(int i=1;i<=n;i++){
      scanf("%d",&a[i]);
      if(a[i]!=i){
        cnt++;
      }
    }
  if(k<=cnt){
    for(int m=1;m<=k;m++){
  	ans=a[ans1];
    ans1=ans;
 	 }
      printf("%d",ans1);
    return 0;
  }
  long int t=k%cnt;
  for(int m=1;m<=t;m++){
  	ans=a[ans1];
    ans1=ans;
  }
  printf("%d",ans1);
}