#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define SIZE 100
#define rep(i, N) for (i = 0; i < N; i++) //制御変数iを用いてN回転
#define array(N, t) (t*)calloc(N, sizeof(t)) //t型N要素の配列を動的確保後0クリア(freeを忘れずに)
#define zero(a); {int iter; rep(iter, sizeof(a)/sizeof((a)[0])) (a)[iter]=0;} //1次元配列aのゼロ初期化?
typedef long long ll;
void printa_int(int *a, int size); //int型の1次元配列aを出力(for debug)

int main() {
    int N, i;
    ll K;
    scanf("%d %lld", &N, &K);
    int *A = array(N, int);
    char *visit = array(N, char);
    int *way = array(N, int);

    rep(i, N) {
        scanf("%d", A + i);
        A[i]--;
    }

    int head = -1, r = -1, loop = 0;
    way[0] = 0;
    visit[0]++;
    for (i = 1; i < N; i++) {
        head = way[i] = A[way[i - 1]];
        if (++visit[head] > 1) break;
    }
    free(A);
    free(visit);
    rep(i, N) {
        if (way[i] == head) {
            if (r == -1) r = i;
            else {
                loop = i - r;
                break;
            }
        }
    }
    if (K < i) printf("%d\n", way[K] + 1);
    else printf("%d\n", way[r + (K - r) % loop] + 1);
    free(way);
    return 0;
}

void printa_int(int *a, int size) {
    int i;
    for (i = 0; i < size; i++)
        printf("%d, ", a[i]);
    printf("\n");
}