#include <bits/stdc++.h>
using namespace std;

int main() {
    long long N, K;  cin >> N >> K;
    vector<int> f(N), f_cp(N);
    for (int i = 0; i < N; ++i) {
        cin >> f[i];
        --f[i];
        f_cp[i] = f[i];
    }

    int now = 0;
    while (K) {
        if (K & 1) now = f[now];
        for (int i = 0; i < N; ++i) f_cp[i] = f[f[i]];
        f = f_cp;
        K >>= 1;
    }

    cout << now + 1 << endl;
}
