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

void solve() 
{
    ll n,k;cin>>n>>k;
    ll a[n];REP(i,n)cin>>a[i];REP(i,n)a[i]--;
    vector<ll>b(n,-1);b[0]=0;
    ll i=1;ll now=a[0];
    for(;b[now]==-1;i++){
        b[now]=i;
        now=a[now];
    }
    ll l=i-b[now];
    // cout<<i<<b[now]<<endl;
    ll t=(k-b[now])%l;
    // cout<<t<<endl;
    REP(j,t){
        now=a[now];
        // cout<<now<<endl;
    }
    cout<<now+1<<endl;
}

int main()
{
    cin.tie(0);
	ios::sync_with_stdio(false);
    solve();
    return 0;
}