#include<bits/stdc++.h>
using namespace std;
#define int long long
int32_t main()
{
  int n,k,i,j;
  cin>>n>>k;
  int a[n+1];
  for(i=1;i<=n;i++)
   cin>>a[i];
  vector<int> v;
  int x,b=a[1];v.push_back(b);map<int,int> m;
  m[b]=v.size()-1;
  while(1)
  {
    b=a[b];
    if(m.count(b)){
      j=m[b];break;}
    v.push_back(b);
    m[b]=v.size()-1;
  }
 if(k<=j)
  cout<<v[k-1];
 else
 {
   k=k-j-1;
   x=v.size()-j;
   k=k%x;
   cout<<v[k+j];
 }
}