// Author - Abhishek giri

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define mod 100000000007
#define V(type) vector<type> 
#define all(c) ((c).begin(),(c).end())
#define in(var) cin>>(var)
#define out(var) cout<<(var)
#define on(var) cout<<var<<"\n"
#define f(i,n) for(ll i = 0 ; i < n ;i++)
#define mfor(i,init,n,b) for(ll i = (init) ; i < (n) ; i+= (b))
#define cfor(i,c) for(auto i = (c).begin() ; i!= (c).end(); i++)

/*##################################################################################*/


/*
int prime[1000001] ;
vector<ll> v ;
void calculateprime()
{
    //calculating primes
    prime[0] = prime[1] = 1 ;
    for(ll i = 2 ; (ll)i*i <= 1000000 ; i++)
    {
        if(prime[i] == 0)
        {
            v.pb(i);
            for(ll j = i*i ; j <= 1000000 ; j += i )
            {
                prime[j] = 1 ;
            }
        }
    }
}
*/

/*
bool isprime(ll n)
{
    for(ll i = 2 ; (ll) i*i <= n ; i++)
    {
        if(n % i == 0){
            return false;
        }
    }
    return true;
}
*/

/*
ll fib(int n) 
{ 
  ll a = 0, b = 1, c, i; 
  if( n == 0) 
    return a; 
  for (i = 2; i <= n; i++) 
  { 
    c = (a + b); 
    a = b; 
    b = c; 
  } 
  return b; 
}
*/

/*
ll gcd(ll a, ll b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b); 
} 

ll extendedgcd(ll a, ll b, ll& x, ll& y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll x1, y1;
    ll d = extendedgcd(b, a % b, x1, y1);
    x = y1;
    y = x1 - y1 * (a / b);
    return d;
}

*/
/*
ll findgrouplcm(ll arr[], ll n) 
{ 
    ll ans = arr[0]; 
  
    for (ll i = 1; i < n; i++) 
        ans = (arr[i] * (ans/(gcd(arr[i], ans))));
  
    return ans; 
}


ll powerwithmod(ll x, unsigned ll y, ll p)  
{  
    ll res = 1;    
  
    x = x % p; 
   
    if (x == 0) return 0;
  
    while (y > 0)  
    {  
        if (y & 1)  
            res = (res*x) % p;  
   
        y = y>>1; // y = y/2  
        x = (x*x) % p;  
    }  
    return res;  
}

*/

/*
ll setBitNumber(ll n) 
{ 
    n |= n >> 1; 
    n |= n >> 2; 
    n |= n >> 4; 
    n |= n >> 8; 
    n |= n >> 16; 
    n |= n >> 32;
    n = n + 1; 
  
    return (n >> 1); 
} 
*/

/*
void decToBinary(ll n,string &s) 
{ 
    for (int i = 63; i >= 0; i--) { 
        int k = n >> i; 
        if (k & 1) 
            s += "1"; 
        else
            s += "0"; 
    } 
}
*/
/*
void countdiv(ll l,set<ll> &v){
    int div = 0 ;
    for(ll i = 2 ;i*i <= l ; i++){
        if(l % i == 0){
            v.insert(i);
            v.insert(l/i);
        }
    }
}
*/

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll testcases = 1;
    //cin>>testcases;
    while(testcases--)
    {
        ll n ,k;
        in(n)>>k;
        int arr[n];
        vector<int> v ;
        f(i,n)  in(arr[i]);
        int cur = 1 ,cnt = 0 ;
        if(k <= n ){
            while(k--){
                cur = arr[cur-1];
            }
            cout<<cur;
            return 0 ;
        }
        int used[n+1] = {0};
        v.pb(1);
        f(i,n+1){
            v.pb(arr[cur-1]);
            cur = arr[cur-1];
        }
        f(i,v.size()){
            if(used[v[i]-1] == 1){
                break;
            }
            ++cnt;
            used[v[i]-1] = 1;
        }
        int per = -1;
        for(int i = cnt ; ; ){
            bool flag = false;
            for(int j = 0 ;  j < i ; j++){
                if(v[i] == v[j]){
                    flag = true;
                    per = i-j;
                    break;
                }
            }
            break;
        }
        if(per == -1){
            per = cnt ;
        }
        //cout<<per <<" "<<cnt<<"\n";
        
        if(k > cnt){
            cout<<v[(k-(cnt-per))%per+(cnt-per)];
        }
        else{
            cout<<v[k-1];
        }
        
        
        
        /*
        for(auto i  : used){
            cout<<i<<" ";
        }
        cout<<endl;
        */
        /*
        cout<<endl;
        for(auto i : v){
            cout<<i<<" ";
        }
        */
        
        //cout<<cnt;
        
    }
    return 0;
}

Measured memory_bytes: 5844