process.stdin.resume();
process.stdin.setEncoding('utf8');
var lines = [];
var reader = require('readline').createInterface({
    input: process.stdin,
    output: process.stdout,
    terminal: false
});
reader.on('line', (line) => {
    lines.push(line);
});
reader.on('close', () => {
    const [n, k] = lines[0].split(" ").map(e => parseInt(e));
    let K = BigInt(k);
    const a = lines[1].split(" ").map(e => parseInt(e));
    let s = [];
    let ord = new Array(n + 1).fill(-1);

    let v = 1;
    while (ord[v] === -1) {
        ord[v] = s.length;
        s.push(v);
        v = a[v - 1];
    }
    let l = ord[v];
    let c = s.length - l;
    if (K < l) {
        console.log(s[k]);
    } else {
        K -= BigInt(l);
        const mod = parseInt(K % BigInt(c));
        console.log(s[l+mod]);
    }
});