import java.util.*

fun main() {
  val sc = Scanner(System.`in`)
  val n = sc.nextInt()
  val k = sc.nextLong()
  
  val telepo = mutableListOf<Int>()
  for (i in 1..n) {
    telepo.add(sc.nextInt())
  }
  
  val dup = mutableMapOf<Int, Long>()
  
  var idx = 1
  var i = 1L
  while (i <= k) {
  	val next = telepo[idx - 1]
    
    if (dup.containsKey(next)) {
      val p = dup[next]!!
      val ni = (k - i) % (i - p)
      val newi = k - ni + 1
      if (i < newi) {
        i = newi
        idx = next
        continue
      }
    }
    
    dup.put(next, i)
    idx = next
    i += 1
  }
  println(idx)
}