"use strict";
var input = require("fs").readFileSync("/dev/stdin", "utf8");
var cin = input.trim().split(/ |\n/), cid = 0;

function main() {
    let N = +cin.shift();
    let K = BigInt(cin[0]);
    let A = cin.map(i => +i);
    let visit = [];
    let p = 1;
    let offset = 0;
    let interval = 0;
    let map = Array(N);
    for (let i = 0; i < N; i++) {
        visit.push(p);
        map[p] = 1;
        let next = A[p];
        if (map[next]) {
            offset = visit.indexOf(next);
            interval = visit.length - offset;
            break;
        }
        p = next;
    }
    //  console.log(visit)
    // console.log({interval,offset})
    let ans;
    if (K <= offset) {
        ans = visit[K];
    } else {
        let O = BigInt(offset);
        let I = BigInt(interval);
        ans = visit[O + (K - O) % I];
    }
    console.log(ans);
}
main();
