Class Main
    Public Shared Sub Main()
    Dim NM() As string = Split(Console.ReadLine())
    dim N as integer = cint(NM(0))
    dim M as long = clng(NM(1))
    dim CS() as string = Split(Console.ReadLine())
    dim C(N) as integer
    dim X(N) as integer
    dim i1,i2,i3 as long
    for i1 = 0 to N - 1
	    C(i1 + 1) = cint(CS(i1))
   	 	X(i1 + 1) = 0
  	next i1
  	i2 = 1
  	X(1) = 1
  	for i1 = 1 to M
  		i2 = C(i2)
  		if X(i2) = 0 then
    		X(i2) = i1 + 1
'    Console.WriteLine(X(i2) & "-" & i2)
  		else
'    Console.WriteLine(X(i2) & " " & i2)
      			for i3 = 1 to ((M - i1) mod (i1 - X(i2)))
  					i2 = C(i2)
'    Console.WriteLine("mod " & i2)
  				next i3
  exit for   
  		end if
	next i1
      Console.WriteLine(i2)
   End Sub
End Class