function main(input) {
  const lines = input.trim().split("\n");
  let [n, k] = lines[0].split(' ');
  n = +n;
  k = BigInt(k);
  const towns = lines[1].split(' ').map(Number);

  const visited = [];
  let pos = 1;
  while (k > 0) {
    const i = visited.indexOf(pos);
    if (i !== -1) {
      const cycle = BigInt(visited.length - i);
      const rest = Number( (k % cycle).toString() );
      pos = towns[i + rest];
      k = 0;
    } else {
      visited.push(pos);
      pos = towns[pos - 1];
      k--;
    }
  }
  
  console.log(pos);
}

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