import scala.collection.mutable
import scala.io.StdIn._
import scala.util.control.Breaks

object Main extends App {
  val Array(n, k) = readLine.split(" ").map(_.toLong)
  val destinations = ("0 " + readLine).split(" ").map(_.toInt)

  var current = 0
  var visited = Array.empty[Int]
  val stepsToVisit = mutable.Map.empty[Int, Int]

  val br = new Breaks
  br.breakable {
    while (true) {
      val jumps = visited.length
      current = if (jumps == 0) 1 else destinations(current)

      if (jumps == k) {
        br.break()
      }

      if (stepsToVisit.contains(current)) {
        val loopSize = jumps - stepsToVisit(current)
        val shortcut = ((k - stepsToVisit(current)) % loopSize).toInt
        current = visited(stepsToVisit(current) + shortcut)
        br.break()
      }

      stepsToVisit.put(current, jumps)
      visited :+= current
    }
  }

  println(current)
}

