"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0].split(" ")[0]);
    const K = BigInt(arg[0].split(" ")[1]);

    const A = arg[1].split(" ").map(n=>parseInt(n-1));
    
    let array = [0];
    let loopStart;
    
    let usedIndex = [];
    
    let next = 0;
    
    while(true) {
        if(usedIndex.indexOf(A[next]) !== -1) {
            loopStart = A[next];
            array.push(A[next]);
            break;
        }
        
        usedIndex.push(next);
        array.push(A[next]);
        // console.log("A[next]:" + A[next]);
        
        next = A[next];
        // console.log("next:" + next);
    }
    
    // console.log(loopStart)
    
    const loop = array.slice(loopStart+1);
    
    // console.log(loop);
    // console.log(array);
    
    if(K <= BigInt(array.length)) {
        console.log(array[K-1n]+1n);
    } else {
        //console.log((K-array.length) % loop.length);
        let temp = (K-BigInt(array.length)) % loop.length;
        // console.log(temp)
        
        if(temp === 0) {
            console.log(loop[loop.length-1] + 1);
        } else {
            console.log(loop[temp - 1] + 1);
        }
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));