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 current = 0
  var townByStep = Array.empty[Int]
  val stepByTown = Array.fill[Int](n.toInt)(-1)

  while (stepByTown(current) == -1) {
    stepByTown(current) = townByStep.length
    townByStep :+= current
    current = destinations(current)
  }
  val loopSize = townByStep.length - stepByTown(current)
  val stepsBeforeLoop = stepByTown(current)

  val ans =
    if (k < stepsBeforeLoop) townByStep(stepsBeforeLoop)
    else townByStep(stepsBeforeLoop + ((k - stepsBeforeLoop) % loopSize).toInt)

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