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(" ");
    const K = BigInt(k);
    const datas = lines[1].split(" ").map(e => parseInt(e));
    let telep = [];
    telep.push(1);
    while(true){
        const a = datas[telep[telep.length - 1] - 1];
        if (telep.some(e => e === a)){
            telep.push(a);
            break;
        }
        telep.push(a);
    }
    //console.log(telep);

    const last = telep.pop();
    const idx = telep.indexOf(last);
    const loop = telep.slice(idx);
    const mod = loop.length;
    const modnum = (K - BigInt(idx)) % BigInt(mod);

    // console.log(loop);
    // console.log(`last:${last} idx:${idx} mod:${mod} modnum:${modnum}`);
    if (K < BigInt(idx)){
        console.log(telep[idx]);
    }else{
        console.log(loop[modnum]);
    }
});