#include <stdio.h>
#include <stdlib.h>
#include <string.h>

//できてない

int main(){
    int n;
    long int k;
    if(scanf("%d %ld%*[^\n]%*c", &n, &k)==EOF){return 0;}
    getchar(); 
    //printf("k:%ld", k);
    char s[6*n];
    int a[n];
    int i = 0;
    char *p;
    if(fgets(s, 6*n, stdin)==NULL){return 0;}
    //printf("s1:%s", s);
    p = strtok(s, " ");
    while(p){   
        a[i] = atoi(p);
        //printf("p:%s a[i]:%d\n", p, a[i]);
        i++;
        p = strtok(NULL, " ");
    }

    int now = 1;
    int cycle[n];
    for (int l = 0; l< n; l++){cycle[l]= -1;}
    int flag = 1;
    for (long int j = 0; j< k; j++){
        printf("j:%ld, now:%d, next:%d\n", j, now, a[now-1] );
        
        if(flag==1){
            if(cycle[now-1] == -1){cycle[now-1]=j;} 
            else{
                long int t = j - cycle[now-1];
                printf("cycle from %d, t:%ld\n", now, t);
                //int now2 = now;
                //for(int r = 0; r<t; r++){printf("%d→",now2); now2 = a[now2-1]; }
                long int b = (k-cycle[now-1])/t;
                j = cycle[now-1] + (b-1)*t;
                //j += t*b ;
                printf("JUMP b:%ld t*b:%ld j:%ld now:%d\n", b, t*b,j, now);
                flag = 0;
                //continue;
            }
        }
        //printf("%ld:%d→%d \n", j, now, a[now-1]);
        now = a[now-1];
        
    }

    //printf("\n%d\n", now);
    printf("%d\n", now);
    return 0;
}
