#include <bits/stdc++.h>
using namespace std;

int main(){
long long int n,k,d,e,f;
  cin>>n>>k;
   vector<long long> c(n+1);
  bool finished=false;
  c.at(0)=1;
  vector<long long> a(n);
  for(long long i=0;i<n;i++){
cin>>a.at(i);
  }
for(long long i=1;i<n+1;i++){
  c.at(i)=a.at(c.at(i-1)-1);
  for(long long j=0;j<i;j++){
if(c.at(j)==c.at(i)){
 d=i-j;
  e=j;
  finished=true;
  break;
}
  }
  if(finished==true){
break;
  }
}
if(k<=e){
cout<<c.at(k)<<endl;
}else{
  f=(k-e)%d;
  cout<<c.at(e+f)<<endl;
}
}
  
  


  
