local N = io.read("*n")
local K = 0LL + io.read("*n")

local A = {}
for i = 1, N do
	A[i] = io.read("*n")
end

local function goToK(town, rem_times)
	if rem_times <= 0 then
		return town
	else
		return goToK(A[town], rem_times - 1)
	end
end

local have_comes = {}
local function teleport(town, times)
	if times == K then
		return town
	end
	local last_time = have_comes[town]
	if last_time ~= nil then
		local K_in_loop = K - last_time
		local loop_times = times - last_time
		K_in_loop = K_in_loop % loop_times
		return goToK(town, K_in_loop)
	else
		have_comes[town] = times
		return teleport(A[town], times + 1)
	end
end

print(teleport(1, 0))