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

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

}
main();
