#include<stdio.h>

int main(){
    int i,c,N,place;
    unsigned long long int K;
    scanf("%d %llu\n",&N,&K);
    int A[N];
    for(i=0;i<N;i++){
        scanf("%d",&c);
        A[i]=c;
    }
    place=1;
    for(i=0;i<K;i++){
        place = A[place-1];
    }
    printf("%d\n",place);
    //printf("%d\n",K);
    return 0;
}