#include<bits/stdc++.h>
using namespace std;
int main(){
  int64_t n,k,i,i1,i2;
  cin>>n>>k;
  vector<int64_t> a(n),b(n+1);
  set<int64_t> s;
  for(i=0;i<n;i++) cin>>a.at(i);
  for(i=0;i<=n;i++){
    if(i==0) b.at(i)=1;
    else b.at(i)=a.at(b.at(i-1)-1);
    if(s.count(b.at(i))) break;
    else s.insert(b.at(i));
  }
  i2=i;
  for(i1=0;i1<i2;i1++) if(b.at(i1)==b.at(i2)) break;
  if(k<i1) cout<<b.at(k)<<endl;
  else{
    i=(k-i1)%(i2-i1)+i1;
    cout<<b.at(i)<<endl;
  }
}