#include <stdio.h>

int main(){
    int N;
    long int K;
    int A[200001]={0};
    scanf("%d%ld", &N, &K);
    int i = 0;
    for (i = 0; i < N;i++){
        scanf("%d", &A[i]);
    }

    int roop[200001]={0};
    int here = 1;
    int r = 0;
    int head = 0;
    for (i = 0; i < 2*N+1;i++){
        roop[i] = here;
        here = A[here-1];
        for (int j = 0; j < sizeof(roop) / sizeof(int);j++){
            if(roop[j]==here){
                head = j;
                r=i;
                break;
            }
        }
        if(r!=0){
            break;
        }
    }
    K = K - head + 1;
    int num1= 0;
    num1 = r - head + 1;
    int num2 = 0;
    num2 = K % num1;
    printf("%d", roop[num1 + num2 + head - 1]);
    return 0;
}