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

A = [0] + list(map(int,input().split()))

T = {1:1}

current_town = 1

for i in range(2,K+1):

    current_town = A[current_town]

    K -= 1

    if current_town in T:

        loop_towns = list(T.keys())[T[current_town]-1:]

        print((loop_towns[K%len(loop_towns)]))

        break

    else:

        T[current_town] = i

else:

    print((A[current_town]))
N,K=list(map(int,input().split()))

A=[0]+list(map(int,input().split()))

T={1:1}

c=1

for i in range(2,K+1):

    c=A[c]

    K-=1

    if c in T:

        l = list(T.keys())[T[c]-1:]

        print((l[K%len(l)]))

        break

    else: T[c]=i

else: print((A[c]))
N, K = list(map(int, input().split()))
A = [0] + list(map(int, input().split()))
T = {1: 1}
current_town = 1
for i in range(2, K + 1):
    current_town = A[current_town]
    K -= 1
    if current_town in T:
        loop_towns = list(T.keys())[T[current_town] - 1 :]
        print((loop_towns[K % len(loop_towns)]))
        break
    else:
        T[current_town] = i
else:
    print((A[current_town]))

N, K = list(map(int, input().split()))
A = [0] + list(map(int, input().split()))
T = {1: 1}
c = 1
for i in range(2, K + 1):
    c = A[c]
    K -= 1
    if c in T:
        l = list(T.keys())[T[c] - 1 :]
        print((l[K % len(l)]))
        break
    else:
        T[c] = i
else:
    print((A[c]))

-current_town = 1 +c = 1 -    current_town = A[current_town] +    c = A[c] -    if current_town in T: -        loop_towns = list(T.keys())[T[current_town] - 1 :] -        print((loop_towns[K % len(loop_towns)])) +    if c in T: +        l = list(T.keys())[T[c] - 1 :] +        print((l[K % len(l)])) -        T[current_town] = i +        T[c] = i -    print((A[current_town])) +    print((A[c]))