fun <T> readList(del:String = " ",f:String.()->T) = readLine()!!.split(del).map {f(it)}

fun main() {
	var (n,k) = readList {toLong()}
	val a = readList {toInt()-1}
	val c = Array(a.size) {-1}

	var i = 0
	var t = 0
	while(k>=0) {
		if(c[i]>=0)
			k %= t-c[i]

		if(k==0L) {
			println(i+1)
			return
		}
		--k
		c[i] = t++
		i = a[i]
	}
}
