sdusing namespace std;
#include <bits / stdc ++. h>
#define int long long
#define pb push_back 
#define IOS ios_base :: sync_with_stdio (0); cin.tie (0); cout.tie (0)
#define ff first
#define ss second
#define all (x) x.begin (), x.end ()
#define repa (i, a, b) for (int i = a; i <= b; i ++)
#define repd (i, b, a) for (int i = b; i> = a; i--)
#define endl "\ n"
//debugging
#define debug1(a) cout<<#a<<" = "<<(a)<<endl;
#define debug2(a,b) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<endl;
#define debug3(a,b,c) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<endl;
#define debug4(a,b,c,d) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<", "<<#d<<" = "<<(d)<<endl;

const int N = 1e+6+5;
int big = 1e+18+3;
int mod = 1e+9+7;

signed main()
{
    IOS;
        
    int n,k;
    cin >> n >> k;
    int ar [n + 1];
    repa (i, 1, n)
        cin >> ar [i];
    bool vis [n + 1] = {0};
    int cur = 1;
    vector <int> sequence;

    while (! vis [cur])
    {
        sequence.pb (cur);
        vis [cur] = true;
        cur = ar [cur];
    }
    int lst = cur;
    sequence.pb (cur);

    if (k <= sequence.size ()-1)
        cout << sequence [k] << endl;
    else
    {
        k- = sequence.size ();

        vector <int> recur;
        bool found = false;
        for (auto it: sequence)
        {
            if (found)
                recur.pb (it);

            if (it == lst)
            {
                found = true;
                continue;
            }
        }
        cout << recur [k% (recur.size ())] << endl;
    }

}
