N,K = list(map(int, input().split()))

A = [*[int(x)-1 for x in input().split()]]

index = [-1]*N

path = []

pre = 0

while index[pre] < 0:

    index[pre] = len(path)

    path += [pre]

    pre = A[pre]

one = index[pre]

loops = len(path) - one



k = max(0, K-one) % loops + min(K, one)

pre = 0

for _ in range(k): pre = A[pre]

print((pre + 1))



# if K <= one: print(path[K])

# else: print(path[(K-one) % loops + one]+1)

N,K = list(map(int, input().split()))

A = [*[int(x)-1 for x in input().split()]]

index = [-1]*N

path = []

pre = 0

while index[pre] < 0:

    index[pre] = len(path)

    path += [pre]

    pre = A[pre]

one = index[pre]

loops = len(path) - one

if K < one: print((path[K]+1))

else: print((path[(K-one) % loops + one]+1))

N, K = list(map(int, input().split()))
A = [*[int(x) - 1 for x in input().split()]]
index = [-1] * N
path = []
pre = 0
while index[pre] < 0:
    index[pre] = len(path)
    path += [pre]
    pre = A[pre]
one = index[pre]
loops = len(path) - one
k = max(0, K - one) % loops + min(K, one)
pre = 0
for _ in range(k):
    pre = A[pre]
print((pre + 1))
# if K <= one: print(path[K])
# else: print(path[(K-one) % loops + one]+1)

N, K = list(map(int, input().split()))
A = [*[int(x) - 1 for x in input().split()]]
index = [-1] * N
path = []
pre = 0
while index[pre] < 0:
    index[pre] = len(path)
    path += [pre]
    pre = A[pre]
one = index[pre]
loops = len(path) - one
if K < one:
    print((path[K] + 1))
else:
    print((path[(K - one) % loops + one] + 1))

-k = max(0, K - one) % loops + min(K, one) -pre = 0 -for _ in range(k): -    pre = A[pre] -print((pre + 1)) -# if K <= one: print(path[K]) -# else: print(path[(K-one) % loops + one]+1) +if K < one: +    print((path[K] + 1)) +else: +    print((path[(K - one) % loops + one] + 1))