"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
    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 len = BigInt(visited.slice(start).length)
    tmp = (k - BigInt(start) + 1n) % len
    let curr = visited[visited.length - 1]
    while (tmp > 0) {
        curr = as[curr]
        tmp--
    }
    console.log(curr)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
