function Main(input) {
  input = input.trim().split("\n").map(function(x) { return x.split(" ")});
  var N = parseInt(input[0][0], 10);
  var K = input[0][1];
  var K1, K2;
  if (K.length > 9){
    K1 = parseInt(K.substr(0, K.length - 9), 10);
    K2 = parseInt(K.substr(-9), 10);

  } else {
    K1 = 0
    K2 = parseInt(K, 10);
  }
  var vec_A = input[1].map(e => (parseInt(e, 10)));
  var mapRecord = Array.from({length: N}, () => 0);
  var tmpTown = 1;
  var loopStart, loopEnd ,loopStartTown, ans;
  for (var i = 0; i <= N; i++){
    mapRecord[tmpTown - 1] ++;
    if (mapRecord[tmpTown - 1] > 1){
      loopEnd = i;
      loopStartTown = tmpTown;
      break;
    }
    tmpTown = vec_A[tmpTown - 1];
  }
  tmpTown = 1;
  for (var i = 0; i <= N; i++){
    if (tmpTown === loopStartTown){
      loopStart = i;
      break;
    }
    tmpTown = vec_A[tmpTown - 1];
  }
  if (K2 > loopStart || K1 > 0){
    K2 = (K2 - loopStart) % (loopEnd - loopStart) + (K1 % (loopEnd - loopStart)) * (1e+9 % (loopEnd - loopStart));
	K2 %= (loopEnd - loopStart);
    tmpTown = loopStartTown;
  } else {
    tmpTown = 1;
  }
  for (var i = 0; i <= N; i++){
    if (i === K2){
      ans = tmpTown;
      break;
    }
    tmpTown = vec_A[tmpTown - 1];
  } 
  console.log(ans);
}   

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