"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 => BigInt(n));
    let tmp
    if(n<k){
        let visited = [1]
        let i = 1
        let cnt = 1
        while(!visited.includes(as[i-1])){
            visited.push(as[i-1])
            i = as[i-1]
            cnt++
        }
        tmp = k % visited.length
    } else {
        tmp = k
    }

    let curr = 1
    while(tmp>0){
        curr = as[curr]
        tmp--
    }
    console.log(curr)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));  
// 1,2,3,4,5,1,2,3,4