import std;

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

        if (used[p] != -1) {
            // writeln("loop ", step - used[p]);
            auto m = (k - used[p]) % (step - used[p]);
            // writeln("m ", m);
            m += used[p];

            for (int i = 0; i < a.length; i++) {
                if (used[i] == m) return i;
            }
        }

        used[p] = step++;
        // writeln(p, " -> ", a[p]);
        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;
