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

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

C=[0]+[-1]*(n-1)

p=1

c=0

s=-1

e=-1

for i in range(n):

    p=A[p-1]

    c+=1

    if C[p-1]==-1:

        C[p-1]=c

    else:

        s=C[p-1]

        e=c

        break

P=1

if s!=-1 and e!=-1:

    if k<=s:

        while k>0:

            P=A[P-1]

            k-=1

        print(P)

    else:

        l=(k-s)%(e-s)

        k=s+l+1

        while k>1:

            P=A[P-1]

            k-=1

        print(P)

else:

    if k<=n:

        while k>0:

            P=A[P-1]

            k-=1

        print(P)

    else:

        while n>0:

            P=A[P-1]
n,k=list(map(int,input().split()))

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

p=1

if k<=n:

    for i in range(k):

        p=A[p-1]

    print(p)

else:

    D=[0]+[-1]*(n-1)

    for i in range(n):

        p=A[p-1]

        if D[p-1]==-1:

            D[p-1]=i+1

        else:

            l=D[p-1]

            r=i+1-D[p-1]

            m=(k-l)%r+l

            break

    p=1

    for i in range(m):

        p=A[p-1]

    print(p)
n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
C = [0] + [-1] * (n - 1)
p = 1
c = 0
s = -1
e = -1
for i in range(n):
    p = A[p - 1]
    c += 1
    if C[p - 1] == -1:
        C[p - 1] = c
    else:
        s = C[p - 1]
        e = c
        break
P = 1
if s != -1 and e != -1:
    if k <= s:
        while k > 0:
            P = A[P - 1]
            k -= 1
        print(P)
    else:
        l = (k - s) % (e - s)
        k = s + l + 1
        while k > 1:
            P = A[P - 1]
            k -= 1
        print(P)
else:
    if k <= n:
        while k > 0:
            P = A[P - 1]
            k -= 1
        print(P)
    else:
        while n > 0:
            P = A[P - 1]

n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
p = 1
if k <= n:
    for i in range(k):
        p = A[p - 1]
    print(p)
else:
    D = [0] + [-1] * (n - 1)
    for i in range(n):
        p = A[p - 1]
        if D[p - 1] == -1:
            D[p - 1] = i + 1
        else:
            l = D[p - 1]
            r = i + 1 - D[p - 1]
            m = (k - l) % r + l
            break
    p = 1
    for i in range(m):
        p = A[p - 1]
    print(p)

-C = [0] + [-1] * (n - 1) -c = 0 -s = -1 -e = -1 -for i in range(n): -    p = A[p - 1] -    c += 1 -    if C[p - 1] == -1: -        C[p - 1] = c -    else: -        s = C[p - 1] -        e = c -        break -P = 1 -if s != -1 and e != -1: -    if k <= s: -        while k > 0: -            P = A[P - 1] -            k -= 1 -        print(P) -    else: -        l = (k - s) % (e - s) -        k = s + l + 1 -        while k > 1: -            P = A[P - 1] -            k -= 1 -        print(P) +if k <= n: +    for i in range(k): +        p = A[p - 1] +    print(p) -    if k <= n: -        while k > 0: -            P = A[P - 1] -            k -= 1 -        print(P) -    else: -        while n > 0: -            P = A[P - 1] +    D = [0] + [-1] * (n - 1) +    for i in range(n): +        p = A[p - 1] +        if D[p - 1] == -1: +            D[p - 1] = i + 1 +        else: +            l = D[p - 1] +            r = i + 1 - D[p - 1] +            m = (k - l) % r + l +            break +    p = 1 +    for i in range(m): +        p = A[p - 1] +    print(p)