#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma comment(linker, "/stack:200000000")
using namespace std;
using namespace __gnu_pbds;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define sc(n) scanf("%d",&n)
#define scl(n) scanf("%lld",&n)
#define pr(n) printf("%d",n)
#define prl(n) printf("%lld",n)
#define fr(i,n) for(i=0;i<n;i++)
#define frv(i,n) for(i=n-1;i>=0;i--)
#define rep(i,st,en) for(i=st;i<=en;i++)
#define repv(i,en,st) for(i=en;i>=st;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define fill(x,a) memset(x,a,sizeof(x))
#define fout cout<<fixed<<setprecision(7)
#define bi(n) __builtin_popcount(n)
#define bil(n) __builtin_popcountll(n)

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef long double ld;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ods;
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the iterator to kth element.(0-based)

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());      // Use mt19937_64 for 64 bit random nos.
ll myrand(ll n){ return rng()%n;}

ll mod = 1e9+7;
void add(ll &a,ll b,ll md=mod){ a+=b; if( a>=md)a-=md;if(a<0)a+=md;}
ll mul(ll a,ll b){ return (a*b)%mod;}
ll mulmod(ll a,ll b,ll M){ a%=M;b%=M;if(M<=mod)return mul(a,b);ll res=0;while(a>0){
    if (a&1ll){res+=b;if(res>=M)res-=M;}a>>=1;b<<=1;if(b>=M)b-=M;}return res;
}ll ffmod(ll b,ll exp,ll md=mod){ll res =1;while(exp){
    if(exp&1ll)res=(res*b)%md;b =(b*b)%md;exp/=2ll;}return res;
}ll powmod(ll b,ll exp,ll md=mod){ll res =1;while(exp){
        if(exp&1ll)res=mulmod(res,b,md);b =mulmod(b,b,md);exp/=2ll;}return res;
}void mxupd(pii &a,pii b){if(a.f > b.f)a.s=max(a.s,b.f);else{a.s=max(a.f,b.s);a.f=b.f;}
}


const int N = 200010;
const int M = 200010;
const int LN = 20;
int cur[N],vis[N], go[N];

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //ios_base::sync_with_stdio(false);cin.tie(NULL);
    int n,m,i,j,x,q;
    int t=1;
	cin >> n;
	ll k;
	cin >> k;
	rep(i,1,n){
		cin >> go[i];
	}
	int st = 1;
	int len = 0;
	if ( k <=n){
		int st = 1;
		while( k){
			st = go[st];
			k--;
		}
		cout << st << "\n";
	}
	else{
	int st = 1;
	while( !vis[st]){
		cur[len] = st;
		vis[st] = (++len);
		st = go[st];
		k--;
	}
	int sz = len-vis[st]+1;
	//trace(sz);
	k = k%sz;
	cout <<  cur[len-sz+k] << "\n";
	}





    return 0;
}


Measured memory_bytes: 5692