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

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

  var current = 0
  var jumps = 0
  var found = false
  var ans = 0

  val stepsToVisit = mutable.Map.empty[Int, Int]
  var visitedArr = Array.empty[Int]

  while (!found) {
    current = if (jumps == 0) 1 else destinations(current)

    if (jumps == k) {
      ans = current
      found = true
    } else if (stepsToVisit.contains(current)) {
      val stepsToFirstVisit = stepsToVisit(current)
      val loopLen = jumps - stepsToFirstVisit
      val shortcut = ((k - stepsToFirstVisit) % loopLen).toInt
      ans = visitedArr(stepsToFirstVisit + shortcut)
      found = true
    } else {
      stepsToVisit.put(current, jumps)
      visitedArr :+= current
      jumps += 1
    }
  }

  println(ans)
}

