fun main(args: Array<String>) {
    var (n, k) = readLongList()
    val arr = readIntList()
    var next = 1

    // ループを見つけるまで
    val visited = BooleanArray(n.toInt()) { false }
    var loop = -1
    while (k-- > 0) { // 街にきた
        if (visited[next - 1]) { // その街が訪問済みなら
            loop = next
            next = arr[next - 1]
            break
        }
        visited[next - 1] = true
        next = arr[next - 1]
    }

    //println(loop)

    var count = 1
    // 何ステップでループするか見つける
    while (k-- > 0) {
        if (arr[next - 1] == loop) {
            count++
            next = arr[next - 1]
            //println("k = $k")
            //println("count = $count")
            k %= count.toLong()
            //println("k = $k")
            break
        }
        count++
        next = arr[next - 1]
    }

    // 残り
    while (k-- > 0) {
        next = arr[next - 1]
    }

    println(next)
}

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(" "))
    }
}