function Main(input) {
  input = input.trim().split("\n");
  const NK = input[0].split(" ");
  var N = parseInt(NK[0], 10);
  var K = parseInt(NK[1], 10);
  var Aarr = input[1].split(" ").map((n) => parseInt(n, 10));
  var now = 1;
  var d = 0;
  if (N > K) {
    for (var i = 0; i < K; i++) {
      now = Aarr[now - 1];
    }
    console.log(now);
    return;
  }

  t = new Array(N).fill(-1);
  t[0] = 0;
  for (var i = 1; i <= N; i++) {
    now = Aarr[now - 1];
    if (t[now - 1] != -1) {
      d = i - t[now - 1]; //ループ幅
      var sa = i - d + 1; //あまりの部分
      K -= sa;
      if ((K %= d) == 0) {
        K = d;
        K += d;
      } else {
        K %= d;
      }
      K += sa;
      break;
    }
    t[now - 1] = i;
  }
  now = 1;
  for (var i = 0; i < K; i++) {
    now = Aarr[now - 1];
  }
  console.log(now);
}

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