fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)
fun <T> Array<Array<T>>.print() {
    this.forEach {
        println(it.joinToString(" "))
    }
}

fun main() {
    val (_n, k) = readLongList()
    val n = _n.toInt()
    val graph = List(n + 1) { mutableListOf<Int>() }
    readIntList().forEachIndexed { index, i ->
        graph[index + 1].add(i)
    }
    
    val firstVisit = MutableList(n + 1) { -1 }.apply { this[1] = 0 }
    val visitList = mutableListOf(1)
    var current = 1
    var loopFirst = 0
    var loopPeriod = 0
    for (i in 1..n + 1) {
        current = graph[current][0]
        if (firstVisit[current] != -1) {
            loopFirst = firstVisit[current]
            loopPeriod = i - firstVisit[current]
            break
        }
        visitList.add(current)
        firstVisit[current] = i
    }

    if (k < loopFirst+loopPeriod) {
        println(visitList[k.toInt()])
    } else {
        val subList = visitList.subList(loopFirst, visitList.size)
        println(subList[((k - loopFirst) % loopPeriod).toInt()])
    }
}