import java.io.PrintWriter
import java.util.ArrayDeque

fun main() {
    PrintWriter(System.out).use { out ->
        solve(out)
        out.flush()
    }
}

fun solve(out: PrintWriter) {
    val (n, k) = readLongList()
    val aList = readIntegerList().map { it - 1 }
    val count = IntArray(n.toInt()) { -1 }
    var cur = 0
    var i = 0
    while (true) {
        if (count[cur] != -1) {
            break
        }

        count[cur] = i
        i++
        cur = aList[cur]
    }

    if (k - count[cur] < 0) {
        cur = 0
        repeat(k.toInt()) {
            cur = aList[cur]
        }
        println(cur + 1)
    } else {
        val tmp = i - count[cur]
        val tmp2 = (k - count[cur]) % tmp

        repeat(tmp2.toInt()) {
            cur = aList[cur]
        }
        println(cur + 1)
    }
}

fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)
fun readDoubleList() = readStringList().map(String::toDouble)
