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

typedef long long ll;
typedef long double ld;
#define pi 3.14159265359;
#define inf (1 << 21);
#define mod 1000000007;

int main() {
    ll N, K; cin >> N >> K;
    vector<ll> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A.at(i);
    }
    vector<bool> J(N, false); //町iを訪れたかどうか
    ll now = 1, next, cnt = 0;
    J.at(0) = true;
    while (true) {
        next = A.at(now - 1);
        now = next;
        cnt++;
        if (J.at(next - 1) == false) {
            J.at(next - 1) = true;
        }
        else {
            break;
        }
    }
    ll loop = 0;
    J.at(now - 1) = false;
    while (true) {
        next = A.at(now - 1);
        now = next;
        loop++;
        if (J.at(next - 1) == true) {
            J.at(next - 1) == false;
        }
        else {
            break;
        }
    }
    K -= cnt;
    ll n = K % loop;
    for (int i = 0; i < n; i++) {
        next = A.at(now - 1);
        now = next;
    }
    cout << now << endl;
    return 0;
}