"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 = BigInt(0);
    let interval = BigInt(0);
    for (let i = 0; i < N; i++) {
        visit.push(p);
        let next = A[p];
        let temp = visit.indexOf(next);
        if (temp >= 0) {
            offset = BigInt(temp);
            interval = BigInt(visit.length - temp);
            break;
        }
        p = next;
    }
    //  console.log(visit)
  	// console.log({interval,offset})
    let ans;
    if (K <= offset) {
        ans = visit[K];
    } else {
        ans = visit[offset + (K - offset) % interval];
    }
    console.log(ans);
}
main();
