function Main(input){
  input = input.split('\n');
  var k = BigInt(input[0].split(' ')[1]);
  var des = input[1].split(' ').map(x=>parseInt(x));
  var route = [1];
  var next = 1;
  while (route.indexOf(next) == route.length - 1){
    next = des[route[route.length - 1] - 1];
    route.push(next);
  }
  var loopEnt = BigInt(route.indexOf(next));
  var period = BigInt(route.length - 1 - route.indexOf(next));
  var ans = route[loopEnt + (k-loopEnt)%period];
  console.log(ans);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));