#include <stdio.h>
int check(int n,int x,int A[n]){
    int count,p,i;
    count = 0;
    p = x;
    for(i=0; i<n; i++){
        count += 1;
        p = A[p-1];
        if(p == x){
            return count;
        }
    }
    return -1;
}

int main(void){
    int i,n,p,N;
    long long int k;
    scanf("%d %lld",&n,&k);
    int A[n];
    for(i=0; i<n; i++){
        scanf("%d", &A[i]);
    }
    p = 1;
    while (k > 0){
        k -= 1;
        p = A[p-1];
        N = check(n,p,A);
        if(N != -1){
            k = k % N;
        }
    }
    printf("%d",p);
    return 0;
}
