"use strict";

const main = arg => {
    const input = arg.trim().split("\n");
    const [N, K] = input[0].split(" ").map(BigInt)
    const as = input[1].split(" ").map(n => Number(n));

    let loop = [0]
    let current = 0
    let loopStart = 0
    let visited = {}
    for (let i = 0; i < K; i++) {
        current = as[current] - 1
        if (visited[current]) {
            loopStart = loop.indexOf(current)
            loop = loop.slice(loopStart)
            break
        }
        visited[current] = true
        loop.push(current)
    }
    console.log(loop[(K - BigInt(loopStart)) % BigInt(loop.length)] + 1)

}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));  
