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

A = tuple([int(n) - 1 for n in input().split()])



costs = [-1] * N

loc = 0



if K <= N:

    for i in range(K):

        loc = A[loc]

    print((loc + 1))



else:

    costs[loc] = 0

    for i in range(1, K):

        loc = A[loc]



        if costs[loc] >= 0:

            break



        costs[loc] = i



    offset = costs[loc]

    loop = i - offset



    K -= i

    K %= loop



    for _ in range(K):

        loc = A[loc]

    print((loc + 1))
N, K = list(map(int, input().split()))

# A = tuple(map(lambda n: int(n) - 1, input().split()))

A = tuple(map(int, input().split()))



costs = [-1] * N

loc = 1



if K <= N:

    for i in range(K):

        loc = A[loc - 1]

    print(loc)



else:

    costs[loc - 1] = 0

    for i in range(1, K):

        loc = A[loc - 1]



        if costs[loc - 1] >= 0:

            break



        costs[loc - 1] = i



    offset = costs[loc - 1]

    loop = i - offset



    K -= i

    K %= loop



    for _ in range(K):

        loc = A[loc - 1]

    print(loc)
N, K = list(map(int, input().split()))
A = tuple([int(n) - 1 for n in input().split()])
costs = [-1] * N
loc = 0
if K <= N:
    for i in range(K):
        loc = A[loc]
    print((loc + 1))
else:
    costs[loc] = 0
    for i in range(1, K):
        loc = A[loc]
        if costs[loc] >= 0:
            break
        costs[loc] = i
    offset = costs[loc]
    loop = i - offset
    K -= i
    K %= loop
    for _ in range(K):
        loc = A[loc]
    print((loc + 1))

N, K = list(map(int, input().split()))
# A = tuple(map(lambda n: int(n) - 1, input().split()))
A = tuple(map(int, input().split()))
costs = [-1] * N
loc = 1
if K <= N:
    for i in range(K):
        loc = A[loc - 1]
    print(loc)
else:
    costs[loc - 1] = 0
    for i in range(1, K):
        loc = A[loc - 1]
        if costs[loc - 1] >= 0:
            break
        costs[loc - 1] = i
    offset = costs[loc - 1]
    loop = i - offset
    K -= i
    K %= loop
    for _ in range(K):
        loc = A[loc - 1]
    print(loc)

-A = tuple([int(n) - 1 for n in input().split()]) +# A = tuple(map(lambda n: int(n) - 1, input().split())) +A = tuple(map(int, input().split())) -loc = 0 +loc = 1 -        loc = A[loc] -    print((loc + 1)) +        loc = A[loc - 1] +    print(loc) -    costs[loc] = 0 +    costs[loc - 1] = 0 -        loc = A[loc] -        if costs[loc] >= 0: +        loc = A[loc - 1] +        if costs[loc - 1] >= 0: -        costs[loc] = i -    offset = costs[loc] +        costs[loc - 1] = i +    offset = costs[loc - 1] -        loc = A[loc] -    print((loc + 1)) +        loc = A[loc - 1] +    print(loc)