#include <bits/stdc++.h>

//g++ -std=c++11

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

const int MAX = 2e5;
int cont[MAX+1];
int v[MAX+1];

int main() {

    //freopen("input.txt", "r", stdin); 
    //freopen("output.txt", "w", stdout);

    std::ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n;
    ll k;

    cin >> n >> k;
    for (int i=1; i<=n; i++) {
        cin >> v[i];
        cont[i] = 0;
    }

    int pos = 1;
    int cont_aux = 0;
    int contador = 0;
    int aux = 0;
    while(true) {
        cont[pos]++;
        if(cont[pos]==2)
            cont_aux = contador;
        else if(cont[pos]==3) {
            aux = contador-cont_aux;
            k%=aux;
            if(k<=0) break;
        }
        pos = v[pos];
        --k;
        ++contador;
        if(k<=0) break;
    }
    cout << pos << endl;
    return 0;
}