/**
       **********    ************
	  Author : Avi J Patel
	  University : DAIICT
       **********    ************
**/
#include<bits/stdc++.h>
#include<fstream>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define pb push_back
#define pf push_front
#define mp make_pair 
#define mt make_tuple
#define ff first
#define ss second
#define si size()
#define MOD 1000000007
#define Mod 998244353
#define N 200001
#define large 1844674407370955161
#define For(i,m,n) for(long long i=m;i<n;i++)
#define st(x) sort(x.begin(),x.end())
#define re(x,i) reverse(x.begin()+i,x.end())
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
#define min_heap priority_queue<int, vector<int>, greater<int>>
#define max_heap priority_queue<int>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define pp pair<pair<ll,ll>,pair<ll,ll>>
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> 

bool sortbysec(const pair<int,int> &a, const pair<int,int> &b) 
{ 
    if(a.ss < b.ss) return true; 
	else return false;
}
bool sortbyboth(const pair<int,int> &a, const pair<int,int> &b)
{
	if(a.ff>b.ff) return true;
	else if(a.ff==b.ff) return a.ss<b.ss;
	else return false;
} 
bool sortff_resortss(const pair<int,int> &a, const pair<int,int> &b)
{
	if(a.ff<b.ff) return true;
	else if(a.ff==b.ff) return a.ss>b.ss;
	else return false;
}
bool sortbystring(const string &a, const string &b)
{
	string c=a+b;
	string d=b+a;
	if(c>=d) return true;
	else return false;
}

bool sortby(const pair<pair<int,int>,pair<int,int>> &a, const pair<pair<int,int>,pair<int,int>> &b)
{
	return a.ss.ss<b.ss.ss;
}

ll modi(ll a, ll m) 
{ 
    ll m0 = m; 
    ll y = 0, x = 1; 
    if (m == 1) 
      return 0; 
    while (a > 1) 
    { 
        ll q = a / m; 
        ll t = m; 
        m = a % m, a = t; 
        t = y; 
        y = x - q * y; 
        x = t; 
    } 
    if (x < 0) 
       x += m0; 
    return x; 
} 
ll Logn(ll  n, ll r) 
{ 
    return (n > r - 1) ? 1 + Logn(n / r, r) : 0; 
} 

ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;      // Initialize result 
    x = x % p;  // Update x if it is more than or 
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; // y = y/2 
        x = (x*x) % p; 
    } 
    return res; 
} 

ll modinv(ll n, ll p) 
{ 
    return power(n, p-2, p); 
} 

int main()
{
	FAST
	int t=1;
//	cin>>t;
	while(t--)
	{
		ll n,k;
		cin>>n>>k;
		vector<ll> a(n);
		for(int i=0;i<n;i++)
		{
			cin>>a[i];
		}
		vector<ll> b;
		b.pb(1);
		map<ll,ll> m;
		int loc=1;
		m[1]=1;
		int temp;
		while(1)
		{
			if(m[a[loc-1]]==1)
			{
//				cout<<a[loc-1]<<endl;
				temp=a[loc-1];	
				break;
			}
			b.pb(a[loc-1]);
			m[a[loc-1]]=1;
			loc=a[loc-1];
		}
//		for(int i=0;i<b.size();i++)
//		{
//			cout<<b[i]<<" ";
//		}
//		cout<<endl;
//		cout<<temp<<endl;
		loc=0;
		while(b[loc]!=temp)
		{
			loc++;
		}
//		cout<<loc<<endl;
		if(k>=loc)
		{
			k-=loc;	
			cout<<b[loc+k%(b.size()-loc)];	
		}
		else
		{
			cout<<b[k];
		}
		
//		cout<<b.size()<<endl;	
		
	}
	return 0;
}
















Measured memory_bytes: 18604