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)

  var current = 0;
  var jumps = 0;
  var found = false
  var ans = Int.MinValue

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

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

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

  println(ans + 1)
}

