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

  while (ord(v) == -1) {
    ord(v) = s.length
    s :+= v
    v = destinations(v)
  }
  val c = s.length - ord(v)
  val l = ord(v)

  val ans = if (k < l) s(l) else s(l + ((k - l) % c).toInt)
  println(ans + 1) // 1 based index
}
