#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vii;
typedef vector<ll> vll;
typedef pair<int,int> pii;

#define FASTIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define ff it->first
#define ss it->second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(auto i=0;i<n;++i)
#define LOOP_IT(it,s) for(auto it=(s).begin();it!=(s).end();++it)


#ifdef LOCAL
#define cerr cout
#else
#endif

#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


void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}


template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif



int main(int argv, char* argc[])
{
    FASTIO


    /*ll n,m,x,mn=2e18;
    cin>>n>>m>>x;
    vll c(n);
    vector<vll> v(n);
    vll res(m);

    rep(i,n)
    {
        cin>>c[i];
        rep(j,m)
        {
            ll xx; cin>>xx;
            v[i].pb(xx);
        }
    }
    ll p = (ll)ceil(pow(2,n));

    for(ll i=0;i<p;++i)
    {
        bitset<15> s(i);
        ll tot = 0;

        res.clear();
        res.resize(m);


        rep(j,n)
        {
            if(s[j]==0)
                continue;
            tot+=c[j];

            ll cnt=0;
            for(ll k=0;k<m;++k)
            {
                res[k]+=v[j][k];
                if(res[k]>=x)
                    ++cnt;
            }

            if(cnt==m)
                mn = min(mn,tot);
        }

    }
    if(mn==2e18)
        mn=-1;
    cout<<mn;*/









    ll n,k;
    cin>>n>>k;
    vll v(n+1),vis(n+1);

    rep(j,n)
    cin>>v[j+1];




    if(k>n)
    {
        ll cnt=0;
        bool f=0;
        ll i=1;
        vis[1]=1;
        while(1)
        {
            ++cnt;
            i = v[i];
            if(!vis[i])
                vis[i] = 1;
            else
                {f=1;break;}
        }

        vis.clear();
        vis.resize(n+1,0);

        ll len=0;
        vis[i]=1;
        while(1)
        {
            ++len;
            i = v[i];
            if(!vis[i])
                vis[i] = 1;
            else
                {f=1;break;}
        }
        rep(j,(k-cnt)%len)
        {
            i = v[i];
        }
        cout<<i;
    }
    else
    {
        ll i=1;
        rep(j,k)
        i=v[i];
        cout<<i;
    }


    return 0;
}



Measured memory_bytes: 6312