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

#define rep(i, n) for(int i = 0; i < n; i++)
#define FOR(i, a, b) for(int i = a; i < n; i++)

typedef long long ll;

int main() {
    ll N,K;
    cin>>N>>K;
    long A[N];
    rep(i, N) cin>>A[i];

    long to = 0;
    vector<long> a(N, -1);
    long i = 0;
    vector<long> c;
    while(a[to] == -1){
        c.push_back(to);
        a[to] = i;
        to = A[to]-1;
        i++;
        //cout << to << endl;
    }
    //cout << "-" << endl;
    for(long b : c){
        //cout << b << endl;
    }
    //cout << "-" << endl;
    K -= a[to];
    //cout << i << a.size() << endl;
    K %= i-a[to];
    //cout << K << endl;
    cout << c[a[to]+K]+1 << endl;
}