
function Main(input)
{
	input = input.split("\n");
	var inp = input[0].split(" ");
	var dat = input[1].split(" ");

	var k = parseInt(inp[1]);

	var startp = parseInt(dat[dat[1 - 1] - 1]);
	var nowp = startp;
	var p = [];
	p.push(startp);
	
	while(true)
	{
		var goTo = parseInt(dat[nowp - 1]);
		nowp = goTo;
		if (nowp == startp)
		{
			break;
		}else{
			p.push(goTo);
		}

	}

	var amac = k % p.length;

	nowp = amac - 1;

	for(var cnt = 0; cnt < amac; cnt ++)
	{
		var goTo = parseInt(dat[nowp - 1]);
		nowp = goTo;
	}

	console.log(nowp);
}


Main(require("fs").readFileSync("/dev/stdin", "utf8"));