function Main(input) {
	var str = input;
	var ans = 0;
	var parr =[];
	var arr = [];
	var c = 0;
	var j = 1;
	str = str.split("\n");
	var k = Number(str[0].split(" ")[1]);
	var p = str[1].split(" ");
　for (var i = 0; i < p.length; i++){
		parr[i] = Number(p[i]);
	}
// 	console.log(parr);
	loop: while(1){
		arr[j] = arr[parr[c]];
		for(var l= 0; l < (j -1) ; l++){
			if(arr[l] === arr[j]){
			break loop;
			}
		}
	c++;
	j++;
	}
	ans = parr[k%(j+1)];
	 console.log(ans);
}
 //*おまじない
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
