/*
 * Author: $%U%$
 * Time: $%Y%$-$%M%$-$%D%$ $%h%$:$%m%$:$%s%$
*/

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;
using vii = vector<ii>;
using vvi = vector<vi>; //vector<vector<int>>
using vvll = vector<vll>;
using vs = vector<string>;

const int INF = 1 << 30;
const int MAX_N = 100000 + 5;
const int MAX_L = 20; // ~ Log N
const ll MOD = 1e9 + 7;
const int xd[4] = {1,0,-1,0}, yd[4] = {0,1,0,-1};

#define PI 3.14159265
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend() 
#define sz(x) (int)((x).size())
#define arrsz(x) (int) (sizeof((x))/sizeof((x)[0]))

#define LSOne(S) (S & (-S))
#define isBitSet(S, i) ((S >> i) & 1)
#define toDigit(x) ((int)((x)-'0'))

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)


/* Usage: dbg(a, b) */
void dbg_out() { cout << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cout << ' ' << H; dbg_out(T...); }
#ifdef PD
#define dbg(...) cout << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
#define dbgn(...) dbg_out(__VA_ARGS__)
#else
#define dbg(...)
#define dbgn(...) 
#endif

// FILE I/O
void setIn(string s) { freopen(s.c_str(),"r",stdin); }
void setOut(string s) { freopen(s.c_str(),"w",stdout); }
void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); }
void setIO(string s = "") {
	unsyncIO();
	// cin.exceptions(cin.failbit); 
	// throws exception when do smth illegal
	// ex. try to read letter into int
	if (sz(s)) { setIn(s+".in"), setOut(s+".out"); } // for USACO
}

/* Usage: output_vector(solution), which prints elements with spaces and then new line*/
template<typename T>
void output_vector(const vector<T> &v, int start = -1, int end = -1) {
    if (start < 0) start = 0;
    if (end < 0) end = int(v.size());
 
    for (int i = start; i < end; i++)
        cout << v[i] << " ";
    cout << endl;
}

/* (x, y) point structure */
template <typename T>
struct Point {
    T x, y;
    
    Point(T _x, T _y) : x(_x), y(_y) {}
    
    friend ostream& operator<<(ostream& os, const Point& p) {
        return os << "(" << p.x << ", " << p.y << ")";
    }
};

/* floor(log2(x)) */
int bit(int x) { return 31-__builtin_clz(x); }

/* division of a by b rounded up, assumes b > 0 */
int cdiv(int a, int b) { return a/b+!(a<0||a%b == 0); }

/* Calculate A^B mod M. Time Complexity: O(logB) */
ll qexp(ll A, ll B, ll M) {
    if (B == 0) return 1;
    ll half = qexp(A, B/2, M) % M;
    half *= half;
    half %= M;
    if (B % 2 == 1) half *= A; 
    return half % M;
}

/* Custom comparator template for sorting */
struct Compare {
    bool operator()(pair<int, int> const & a, pair<int, int> const & b) { 
        if (a.fi != b.fi) {
            return a.fi < b.fi;
        }
        return a.se > b.se; 
    }
};

void run_case() {
    ll N, K;
    cin >> N >> K;
    vi teleports (N, 0);

    vi myTele;
    set<int> seenBefore;

    F0R(i, N) {
        int tp;
        cin >> tp; --tp;
        teleports[i] = tp;
    }

    int loc = 0;

    if (K <= N) {
        F0R(i, K) {
            dbg(loc);
            loc = teleports[loc];
        }
        cout << (loc+1);
    } else {
        while (seenBefore.count(loc) == 0) {
            dbg(loc, teleports[loc]);
            myTele.pb(loc);
            seenBefore.insert(loc);
            loc = teleports[loc];
        }
        //output_vector(myTele);
        dbg(loc);
        int before = 0;
        F0R(i, sz(myTele)) {
            if (myTele[i] == loc) {
                before = i; break;
            }
        }
        int cycleSize = sz(myTele) - before;
        dbg(before);
        dbg(cycleSize);
        if (K >= before) {
            K -= before;
            K = K % cycleSize;
            int ans = myTele[K + before] + 1;
            cout << ans;
        } else {
            int ans = myTele[K] + 1;
            cout << ans;
        }

    }
}

int main() {
    setIO();
    int tests = 1; //cin >> tests;
    while(tests--) {
        run_case();
        dbgn();
    }
}

/**
Remember to check for overflow (long long)
Does number need to be greater than a lower bound?
**/


Measured memory_bytes: 12024