import java.util.Scanner

fun main() {
	val scn = Scanner(System.`in`)
	val n = scn.nextInt()
	val k = scn.nextLong()
	val arr = IntArray(n){scn.nextInt()-1}
	val f = BooleanArray(n){false}
	val list = mutableListOf<Int>()
	var i = 0
	while(!f[i]){
		f[i] = true
		list.add(i)
		i = arr[i]
	}
	val l = list.indexOf(i)
	val r = list.lastIndex
	println(if (k<l) list[k.toInt()]+1 else list[((k-l)%(r-l+1)+l).toInt()]+1)
}