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 = new Map();
  let pos = 1, i;
  while (i = visited.get(pos), i === undefined && k) {
    visited.set(pos, visited.size);
    pos = towns[pos - 1];
    k--;
  }
  if (k > 0) {
    const cycle = BigInt(visited.size - i);
    const rest = Number( (k % cycle).toString() );
    for (let [key, value] of visited) {
      if (value == i + rest) {
        pos = key;
        break;
      }
    }
  }
  
  console.log(pos);
}

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