#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <forward_list>

using namespace std;

typedef long long ll;
typedef vector<long long> vi;
typedef pair<long long, long long> ii;
typedef vector<pair<long long, long long>> vii;
typedef stringstream ss;
ll mil() { return numeric_limits<long long>::min(); }
ll mal() { return numeric_limits<long long>::max(); }

#define R3(i, a, b) for (long long i = (a); i < (b); ++i)
#define R2(i, b) for (long long i = 0; i < (b); ++i)
#define R1(b) for (long long i = 0; i < (b); ++i)
#define RR(i, a, b) for (long long i = a; i > b; --i)
#define PB(x) push_back(x)
#define MP(x, y) make_pair(x, y)

// build: ctrl + f9

// run: shift + f10
// sanitize: shift + f11
// debug: shift + f9

void A()
{
    string S;
    string T;
    cin >> S >> T;

    if (T.substr(0, S.size()) == S)
    {
        cout << "Yes" << endl;
        return;
    }

    cout << "No" << endl;
}

void B()
{
    ll A, B, C, K;

    cin >> A >> B >> C >> K;

    ll tot = 0;
    R1(K)
    {
        if (i < A)
        {
            tot += 1;
        }
        else if (i >= (A + B))
        {
            tot -= 1;
        }
    }

    cout << tot << endl;
}

void ps(ll k, ll l, ll r, vector<vector<long long>> &powerSets, vector<long long> &currSet)
{
    if (k == 0)
    {
        powerSets.push_back(currSet);
    }

    for (int i = l; i < r; ++i)
    {
        currSet.push_back(i);
        ps(k - 1, i + 1, r, powerSets, currSet);
        currSet.pop_back();
    }
}
void C()
{
    ll N, M, X;

    cin >> N >> M >> X;

    vi cis(N, 0);
    vector<vector<long long>> mij(N, vector<long long>(M));

    R1(N)
    {
        cin >> cis[i];
        R2(j, M)
        {
            cin >> mij[i][j];
        }
    }

    vi prices;
    vector<vector<long long>> powerset;
    vector<long long> currSet;
    for (int i = 1; i <= N; ++i)
    {
        ps(i, 0, N, powerset, currSet);
    }
    ll minPrice = mal();
    for (auto s : powerset)
    {
        ll price = 0;
        vi av(M, 0);
        for (auto book : s)
        {
            price += cis[book];
            for (int i = 0; i < mij[book].size(); ++i)
            {
                av[i] += mij[book][i];
            }
        }
        bool lvlOk = true;
        for (auto lvl : av)
        {
            if (lvl < X)
            {
                lvlOk = false;
                break;
            }
        }
        if (lvlOk)
            minPrice = min(minPrice, price);
    }

    if (minPrice != mal())
        cout << minPrice << endl;
    else
        cout << -1 << endl;
}

void cycleLength(ll &cl, ll &il, ll &tcs, vi &ai)
{
    ll count = 1;
    set<ll> visited;
    ll curr = 1;
    map<ll, ll> townAppartion;
    while (visited.count(curr) == 0)
    {
        visited.insert(curr);
        townAppartion[curr] = count;
        curr = ai[curr];
        ++count;
    }

    cl = count - townAppartion[curr];
    il = townAppartion[curr] - 1;
    tcs = curr;
}

void D()
{
    ll N, K;
    cin >> N >> K;
    vi ai(N + 1);
    for (ll i = 1; i <= N; ++i)
        cin >> ai[i];

    ll cl = 0;
    ll il = 0;
    ll tcs = 0;
    cycleLength(cl, il, tcs, ai);

    ll curr = 1;
    if (K >= il)
    {
        ll val = (K - il) % cl;
        curr = tcs;
        R1(val)
        {
            curr = ai[curr];
        }
    }
    else {
        R1(K)
        {            
            curr = ai[curr];
        }
    }

    cout << curr << endl;
}

void E()
{
}

int main()
{


    D();
}


Measured memory_bytes: 26352