fun main() = abc167d()

@OptIn(ExperimentalStdlibApi::class)
fun abc167d() {
    var (n, k) = readLine()!!.split(' ').map { it.toLong() }
    val aList = readLine()!!.split(' ').map { it.toInt() - 1 }.toIntArray()

    val visited = mutableSetOf(0)
    val indices = IntArray(n.toInt())
    indices[0] = 0

    var outerLoop = 0
    var curr = 0

    while (--k >= 0) {
        curr = aList[curr]
        if (!visited.add(curr)) break

        outerLoop++
        indices[curr] = outerLoop
    }

    if (k == -1L) return println(curr + 1)

    val visitedInLoop = mutableSetOf<Int>()
    var loopLength = 0
    val path = IntArray(n.toInt()) { -1 }

    repeat(n.toInt()) {
        if (visitedInLoop.add(curr)) {
            path[curr] = loopLength
            loopLength++
            curr = aList[curr]
        }
    }

    val answer = path.indexOf((k % loopLength).toInt()) + 1

    println(answer)
}
