#include <stdio.h>

int main(void) {
    
    long long N, K;
    scanf("%lld", &N); scanf("%lld", &K);

    int towns[N];
    for (int i=0; i<N; i++) {
        scanf("%d", &towns[i]);
    }

    int location = 1;
    //printf("%d -> ", location);
    location = towns[0];
    for (int i=0; i<K-1; i++) {
        //printf("%d -> ", location);
        location = towns[location-1];
    }

    //printf("%d\n", location);

    printf("%d\n", towns[(K+1)%(N)]);

}