#include<iostream>
using namespace std;

main(){
    int N;
    long long K;
    long long A[210000];
    cin >> N >> K;
    for (int i = 1; i <= N;i++) cin >> A[i];

    long long B[N] = {-1};
    long long current = 1;
    long long start = 0;
    long long roop = 0;
    bool stop = false;
    

    B[1] = 1;
    current = 1;
    for (int j = 1; j <= N;j++){
        int jsize = j;
        for (int k = 1; k <= jsize ;k++){
            if (A[current] == B[k]){
                start = k - 1;
                roop = j - k + 1;
                stop = true;
                break;
            }
        }
        if (stop) {
            break;
        }
        B[j+1] = A[current];
        current = A[current];
    }

    long long rooppoint = (K + 1 - start) % roop;
    if (rooppoint == 0) rooppoint = roop;

    long long pos = start + rooppoint;
    long long last = B[pos];
    cout << last << endl;
  
    return 0;
} 