import scala.collection.mutable
import scala.io.StdIn._

object Main extends App {
  val Array(n, k) = readLine.split(" ").map(_.toLong)
  val destinations = readLine.split(" ").map(_.toInt - 1) // 0 based index

  var currentTown = 0
  var townSequence = Array.empty[Int]
  val initialVisit = mutable.Map.empty[Int, Int]
  var ans = -1;

  while (ans == -1) {
    val jumps = townSequence.length
    if (jumps > 0) {
      currentTown = destinations(currentTown)
    }

    if (jumps == k) {
      ans = currentTown
    } else if (initialVisit.contains(currentTown)) {
      val jumpsToInitialVisit = initialVisit(currentTown)
      val loopSize = jumps - jumpsToInitialVisit
      val shortcut = ((k - jumpsToInitialVisit) % loopSize).toInt
      ans = townSequence(jumpsToInitialVisit + shortcut)
    } else {
      initialVisit.put(currentTown, jumps)
      townSequence :+= currentTown
    }
  }

  println(ans + 1) // 1 based index
}
