// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;



#define ll long long int

ll mod=1e9+7;



vector<ll> g[200005];

ll vis[200005];

// queue<ll> q;

// ll level[200005];



// void dfs(ll i)

// {

//     vis[i] = 1;

//     for(ll j=0;j<g[i].size();j++)

//     {

//         ll child = g[i][j];

//         if(vis[child] == 0)

//         {

//             dfs(child);

//         }

//         else

//         {

//             // you found a cycle.





//         }

        

//     }

// }



// void bfs(ll i)

// {

//     vis[i] = 1;

//     while(!q.empty())

//     {

//         ll top = q.front();

//         ll len_adj = g[top].size();

//         ll j;

//         for(j=0;j<len_adj;j++)

//         {

//             ll v = g[top][j];

//             if(vis[v]==0)

//             {

//                 vis[v]=1;

//                 q.push(v);

//                 level[v] = level[top] + 1;

//             }

//         }   

//         q.pop();

//     }

// }



ll modular_exponentiation(ll base, ll power)

{

    ll ans = 1;

    base = base % mod;

    while (power > 0)

    {

        if (power & 1)

        {

            ans = (ans * base) % mod;

        }



        power /= 2;

        base = (base * base) % mod;

    }

    return ans;

}



int main()

{

    /* Faster input ouput */

    // ios_base::sync_with_stdio(false);

    // cin.tie(NULL);

    // cout.tie(NULL);



    /* To read input from a file and output to a file */

    // freopen("input.txt","r",stdin);

    // freopen("output.txt","w",stdout);

    

    ll t = 1;

    // cin >> t;

    while(t--)

    {        

        ll n,i,j,k;

        cin >> n >> k;

        ll arr[n];

        set<ll> s;



        for(i=0;i<n;i++)

        {

            cin >> arr[i];

            arr[i]--;

        }



        vector<ll> path;



        ll curr_ind = 0;

        ll start_cycle;

        for(i=0;i<n+1;i++)

        {

            

            if(s.find(curr_ind) == s.end())

            {

                // not already reached;

                // cout << curr_ind << '\n';

                s.insert(curr_ind);

                path.push_back(curr_ind);

                curr_ind = arr[curr_ind];

                // g[prev_ind].push_back(curr_ind);

            }

            else

            {

                // here is the start of the cycle

                // cout << "YES\n";

                // cout << curr_ind << '\n';

                start_cycle = curr_ind;

                break;   

            }

        }



        



        // ll len = path.size();

        // k %= len;

        // for(i=0;i<path.size();i++)

        // {

        //     cout << path[i] << " ";

        // }

        // cout << '\n';

        // cout << k << '\n';

        // cout << (path[k] + 1) << '\n';

        // cout << curr_ind+1 << '\n';



        // cout << start_cycle << '\n';



        vector<ll> cycle;

        ll cyc_s_i = 0;



        ll tempk = k;

        for(i=0;i<path.size();i++)

        {

            if(path[i] != start_cycle)

            {

                k--;

            }

            else

            {

                cyc_s_i = i;

                break;

            }

        }



        for(i=cyc_s_i;i<path.size();i++)

        {

            cycle.push_back(path[i]);

        }



        // for(i=0;i<cycle.size();i++)

        // {

        //     cout << cycle[i] << " ";

        // }

        // cout << '\n';



        // cout << tempk << " " << cyc_s_i << '\n';

        if(tempk < path.size())

        {

            cout << (path[tempk]+1) << '\n';

            return 0;

        }



        ll len = cycle.size();

        k %= len;

        cout << (cycle[k] + 1) << '\n';

    }



    

    

}

// Optimized solution to the same problem (faster):
#include "bits/stdc++.h"

using namespace std;



int main()

{

    long long n, k;

    cin >> n >> k;

    long long a[n + 1];

    for (long long i = 1; i <= n; i++)

        cin >> a[i];

    vector<long long> path;

    set<long long> pr;



    long long curr = 1;

    path.push_back(curr);

    pr.insert(1);

    long long st = 0;

    while (true)

    {

        curr = a[curr];

        if (pr.find(curr) != pr.end())

        {

            // st = cycle start number

            st = curr;

            break;

        }

        else

        {

            path.push_back(curr);

            pr.insert(curr);

        }

    }

    vector<long long>::iterator it = find(path.begin(), path.end(), st);

    long long b = it - path.begin();

    long long l = path.size();

    long long int i;

    // for(i=0;i<l;i++)

    // {

    //     cout << path[i] << " ";

    // }

    // cout << '\n';

    // cout << b  << " " << l << '\n';

    

    if (k < l)

    {

        cout << path[k] << endl;

        return 0;

    }

    // cout << "YEs\n";

    k -= b;

    l -= b;

    long long rem = (k % l);

    

    // cout << b << " " << rem << '\n';

    if((b + rem) == 0)

    {

        cout << path[b] << endl;

        return 0;

    }    

    cout << a[path[b + rem-1]] << endl;  



    return 0;

}

// Fastest known solution for this problem: