const input = require("fs").readFileSync("/dev/stdin", "utf8")

;(input => {
 
    const lines = input.split('\n')
    const [N, K] = lines[0].split(' ').map(BigInt)
    const A = [null, ...lines[1].split(' ').map(Number)]

    const r = []
    let c = 0n
    let n = 1

    while (c < K) {
        n = A[n]
        c++
        if (r[n]) {
            break
        } else {
            r[n] = c
        }
    }

    if (r[n] === c) {
        console.log(n)
        return
    }

    const t = (K - (c - 1n)) % (c - r[n])

    c = 1
    while (c < t) {
        n = A[n]
        c++
    }

    console.log(n)
 
})(input)
