import java.util.*

fun main() {
    val sc = Scanner(System.`in`)

    val n = sc.nextInt()
    val k = sc.nextLong()
    val a = IntArray(n) { sc.nextInt() }

    val lastVisit = LongArray(n) { 0L }

    var cur = 1
    var i = 0L
    while (i < k) {
        if (lastVisit[cur - 1] != 0L) {
            //println("loop detected!")
            val loopStart = lastVisit[cur - 1]
            val loopSize = i - loopStart
            //println("loopStart: $loopStart")
            //println("loopSize: $loopSize")
            //println("cur: $cur")
            i = ((k - loopStart) / loopSize) * loopSize + loopStart
            break
        }
        lastVisit[cur - 1] = i
        cur = a[cur - 1]
        i++
    }
    //println("i: $i")
    while (i < k) {
        cur = a[cur - 1]
        i++
    }
    println(cur)
}
