function D167(_input) {
    var lines = _input.split("\n");
    var first = lines.shift().split(' ').map(v => v*1);
    var Cnum = first[0];
    var pNum = first[1];
    var r = lines.shift().split(' ').map(v => v*1);
    var current = 1;
    var route = '1';
    var start = 0;
    var end = 0;

    for (var i = 0; i < Cnum; i++) {
        current = r[current - 1];
        if (route.indexOf(current + "") !== -1) {
            start = route.indexOf(current + "");
            end = i;
            break;
        }
        route += current;
    }

    var num = start + ((pNum - start) % (end - start + 1));
    current = 1;

    for (var i = 0; i < num; i++) {
        current = r[current - 1];
    }

    console.log(current);
}
D167(require("fs").readFileSync("/dev/stdin", "utf8"));