n,k=io.read("*n","*n","*l")
a={}
for i=1,n do
    a[i]=io.read("*n")
end

path={1}
visited={}
position=1
for i=1,n do
    table.insert(path,a[position])
    if not visited[position] then
        visited[position]=true
    else
        break
    end
    position=a[position]
end

loop=0
distance=0
for i=1,#path do
    if path[i]==a[position] then
        loop=#path-i
        distance=i-2
        break
    end
end

x=(k-distance)%loop
for i=1,x do
    position=a[position]
end
print(position)