fun main(args: Array<String>) {
  val (tmp, k) = readLine()!!.split(" ").map { it.toLong() }
  val n = tmp.toInt()
  val a = readLine()!!.split(" ").map { it.toInt()-1 }.toIntArray()
  val count = LongArray(n) { -1L }
  var v = 0
  var c = 0L
  while (true) {
    if (count[v] >= 0) break
    count[v] = c
    v = a[v]
    c++
    if (c == k) {
      println(v+1)
      return
    }
  }
  val period = c-count[v]
  val rem = (k-count[v])%period
  for (i in count.indices) {
    if (count[i]-count[v] == rem) {
      println(i+1)
      return
    }
  }
}