"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 visited = [1]
    let i = 1
    let cnt = 1
    while (cnt <= k && !visited.includes(as[i])) {
        visited.push(as[i])
        i = as[i]
        cnt++
    }
    if(cnt === k){
        console.log(visited[k-1])
        return 
    }
    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])
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
