"use strict";

const main = arg => {
    const input = arg.trim().split("\n");

    const n = BigInt(input[0].split(" ")[0]);
    const k = BigInt(input[0].split(" ")[1]);
    const as = input[1].split(" ").map(n => Number(n));
    as.unshift(0)
    let tmp
    if(n<k){
        let visited = [1]
        let i = 1
        while(!visited.includes(as[i])){
            visited.push(as[i])
            i = as[i]
        }
        let start = visited.indexOf(as[i])
        const cycleLen = BigInt(visited.slice(start).length)
        const firstLen = start
        let rest = (k-BigInt(start)) % cycleLen
        const idx = firstLen + Number(rest)
        console.log(visited[idx])
    } else {
        tmp = k
        let curr = 1
        while(tmp>0){
            curr = as[curr]
            tmp--
        }
        console.log(curr)
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));  
//1,6,2,5,3,2,5,