#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a) for(int i=0;i<(a);i++)
const ll MOD=1000000007;
//const ll MOD=998244353;

int nex[66][202020];

int main(){
  int N; cin>>N;
  ll K; cin>>K;
  int A[N];
  rep(i,N){
    cin>>A[i];
    A[i]--;
    nex[0][i]=A[i];
  }
  rep(i,60) rep(j,N){
    nex[i+1][j]=nex[i][nex[i][j]];
  }
  int ans=0;
  rep(i,61){
    if((1LL<<i)&K) ans=nex[i][ans];
  }
  cout<<ans+1<<endl;
  return 0;
}