// Problem : D - Teleporter
// Contest : AtCoder - AtCoder Beginner Contest 167
// URL : https://atcoder.jp/contests/abc167/tasks/abc167_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//S->----------------------------------------------------|
//R->--------------</AUTHOR - SRIJAN DE>-----------------|
//I->----</JALPAIGURI GOVERNMENT ENGINEERING COLLEGE>----|
//J->------------</INFORMATION TECHNOLOGY>---------------|
//A->-------------</sd2220@it.jgec.ac.in>----------------|
//N->----------------------------------------------------|

#include    <bits/stdc++.h>
#include    <ext/pb_ds/assoc_container.hpp> // Policy_based_Data_Structure 
#include    <ext/pb_ds/tree_policy.hpp>
using       namespace            std;
using       namespace            __gnu_pbds;

/*#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;*/

using       ll=                  int64_t ;
using       ull=                 unsigned long long ;
using       ld=                  long double;
#define     int                  int64_t
#define     mem(a,val)           memset( a,  val,  sizeof(a) )
#define     b_s                  binary_search
#define     u_b                  upper_bound
#define     l_b                  lower_bound
#define     nl                   cout<<endl
#define     pb                   push_back
#define     pf                   push_front
#define     ppb                  pop_back
#define     ppf                  pop_front
#define     in                   insert
#define     fi                   first
#define     se                   second
#define     pqueue               priority_queue
#define     rr                   return
typedef     tree<int, null_type,less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

const int   N=                   1e6+7;
const int   MOD=                 (int)1e9 + 7;
const int   MOD1=                (int)1e9 + 9;
const int   MOD2=                998244353;
const ld    pi=                  atan2(0, -1);
const ld    eps=                 1e-9;
int         tests=               1;

template<class x,class y>x max(x a,y b){return (a>b)?a:b;}
template<class x,class y>x min(x a,y b){return (a<b)?a:b;}
template<class x,class y>x log(x n,y r){return (n>r-1)?1+log(n/r,r):0;}

vector<int> adj[N];
int vis[N]={0};

///.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.

int32_t main() 
{
	auto start = clock();
	ios_base::sync_with_stdio(0);
	cout.tie(0);
	cin.tie(0);	

//	cout<<fixed;
//	cout<<scientific;
//	cout<<fixed<<setprecision(12);
	// cin>>tests;
	for(int test=1;test<=tests;test++) 
	{
//		cout<<"Case #"<<test<<": ";
///.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.

		
		int n,k;
		cin>>n>>k;
		int a[n+1];
		for(int i=0;i<n;i++)
		{
		    cin>>a[i+1];
		}
		map<int,int>mp;
		
		int op=a[1];
		vector<int> vc;
		vc.pb(1);
		while(mp[op]!=1)
		{
		    mp[op]=1;
		    vc.pb(op);
		    op=a[op];
		}
		int ii=0;
		for(int i=0;i<vc.size();i++)
		{
		    if(vc[i]==op)
		    {
		        ii=i;
		        break;
		    }
		}
		if(k<vc.size())
		{
		    cout<<vc[k];
		}
		else
		{
    		k-=ii;
    		k%=vc.size()-ii;
    		k+=ii;
    		cout<<vc[k];
		
		}
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
///.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.
		
	}
	cerr<<endl<<endl<<endl<< "Time : " << double(clock() - start) / CLOCKS_PER_SEC <<endl;
	return 0;
}



Measured memory_bytes: 41912