#include<bits/stdc++.h>
#define rep(i, n) for (int i=0; i<n; i++)
#define ll long long
using namespace std;

//22:14~

int main() {
  int n; ll k; cin>>n>>k;
  vector<int> a(n);
  rep(i, n) cin>>a[i];

  vector<int> s;
  vector<int> ord(n+1,-1);
  int v=1;
  while (ord[v]==-1) {
    ord[v]=s.size();
    s.push_back(v);
    v=a[v-1];
  }
  int cycle=s.size()-ord[v];
  int start=ord[v];
  int res;
  if (k<start) res=s[k];
  else res=s[(k-start)%cycle+start];
  cout<<res<<endl;
}
