fun main(args: Array<String>) {
  val (Ns, Ks) = readStrings()
  val N = Ns.toInt()
  var K = Ks.toLong()
  val AN = readInts()

  val map = hashMapOf<Int, Int>()
  val array = Array(N + 1) { 0 } // i 回目に到着する町がどこか
  array[0] = 1 // 始めは町１
  map[1] = 0

  var loopBegin = -1
  var loopEnd = -1

  for (i in 1..N) {
    val prev = array[i - 1]
    val current = AN[prev - 1]
    array[i] = current
    if (map.contains(array[i])) { // ループしたら終了
      loopBegin = current
      loopEnd = prev
      break
    }
    map[current] = i
  }

//  println(array.joinToString())
//  println(map)
//  println("$loopBegin $loopEnd")

  if (K <= map.size) {
    println(array[K.toInt()])
  } else {
    val begin = map[loopBegin]!!
    val end = map[loopEnd]!!
    val loopSize = end - begin + 1
    K -= begin
    println(array[begin + (K % loopSize).toInt()])
  }
}

fun readString() = readLine()!!
fun readStrings() = readString().split(" ")
fun readInt() = readString().toInt()
fun readLong() = readString().toLong()
fun readInts() = readStrings().map { it.toInt() }
fun readLongs() = readStrings().map { it.toLong() }
