import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val k = sc.nextLong()
    val a = (1..n).map { sc.nextInt() - 1 }
    val used = Array(n) {-1L}

    var pos = 0
    var cost = 0L
    var preCost = -1L
    var loopStart = -1
    var loopCost = -1L
    while (true) {
        if (used[pos] != -1L) {
            loopStart = pos
            loopCost = cost - used[pos]
            preCost = used[pos]
            break
        }

        if (k == cost) {
            println(pos + 1)
            return
        }

        used[pos] = cost
        cost++
        pos = a[pos]
    }

    pos = loopStart
    var remCost = (k - preCost) % loopCost
    while (true) {
        if (remCost == 0L) {
            println(pos + 1)
            return
        }
        remCost--
        pos = a[pos]
    }
}