import std;

int calc(long k, int[] a) {
    a = a.map!"a-1".array;

    auto used = new int[a.length];
    used[] = -1;
    int p = 0;
    int step = 0;
    while (true) {
        if (step == k) {
            return p + 1;
        }

        if (used[p] != -1) {
            auto m = k % (step - used[p]);
            for (int i = 0; i < a.length; i++) {
                if (used[i] == m) return i + 1;
            }
        }

        used[p] = step++;
        p = a[p];
    }
    return 0;
}

void main() {
    long n, k; scan(n, k);
    auto a = readints;
    writeln(calc(k, a));
}

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T=string)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readints = reads!int;
