n, k = list(map(int, input().split()))

a = list(map(int, input().split()))

l = [1]



for i in range(n):

  l.append(a[l[i]-1])

p = l.index(l[n])

#print(p,l[n])

if k<=n:

  print((l[k]))

else:

  x = (k-n+1)%(n-p)

  if x ==0:

    x += (n-p)

    print((l[x-1]))

  else:

    print((l[x+p-1]))

n,k = list(map(int,input().split()))

a = list(map(int,input().split()))

l = [1]

for i in range(n):  

    l.append(a[l[i]-1])

    

p = l.index(l[-1])

if k<=n:

  print((l[k]))

  exit()

  

x = (k-n+1)%(n-p)

if x==0:

  print((l[n-1]))

else:

  print((l[x+p-1]))

n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
l = [1]
for i in range(n):
    l.append(a[l[i] - 1])
p = l.index(l[n])
# print(p,l[n])
if k <= n:
    print((l[k]))
else:
    x = (k - n + 1) % (n - p)
    if x == 0:
        x += n - p
        print((l[x - 1]))
    else:
        print((l[x + p - 1]))

n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
l = [1]
for i in range(n):
    l.append(a[l[i] - 1])
p = l.index(l[-1])
if k <= n:
    print((l[k]))
    exit()
x = (k - n + 1) % (n - p)
if x == 0:
    print((l[n - 1]))
else:
    print((l[x + p - 1]))

-p = l.index(l[n]) -# print(p,l[n]) +p = l.index(l[-1]) +    exit() +x = (k - n + 1) % (n - p) +if x == 0: +    print((l[n - 1])) -    x = (k - n + 1) % (n - p) -    if x == 0: -        x += n - p -        print((l[x - 1])) -    else: -        print((l[x + p - 1])) +    print((l[x + p - 1]))