#include<stdio.h>
#include<string.h>
#define N 200000
int getRep(int a[], int n, int visit[]){
    memset(visit, 0, N * sizeof(int));
    int i = 1, count = 0;;
    while(visit[i] != 1){
        visit[i] = 1;
        i = a[i];
        count++;
    }
    return count;
}
int main(){
    int n;
    long long int k;
    int a[N], visit[N];
    scanf("%d %d", &n, &k);
    for(int i = 1; i <= n; ++i)
        scanf("%d", &a[i]);
    int rep = getRep(a, n, visit);
    //printf("%d\n", rep);
    k %= rep;
    int i = 1, count = 0;
    while(count < k){
        visit[i] = 1;
        i = a[i];
        count++;
    }
    printf("%d", i);
    return 0;
}