# coding: utf-8

# Your code here!

import sys

read = sys.stdin.read

readline = sys.stdin.readline 



n,k,*a = list(map(int,read().split()))

for i in range(n): a[i] -= 1



def pow2(a,n):

    if n==0: return list(range(n))

    if n==1: return a

    if n%2:

        return mul(a,pow2(a,n-1))

    else:

        x = pow2(a,n//2)

        return mul(x,x)



def mul(a,b):

    return [a[bi] for bi in b]



x = pow2(a,k)

print((x[0]+1))
# coding: utf-8

# Your code here!

import sys

read = sys.stdin.read

readline = sys.stdin.readline 



n,k,*a = list(map(int,read().split()))

for i in range(n): a[i] -= 1



na = [0]*n

v = 0

while k:

    if k&1: v = a[v]

    for j, aj in enumerate(a):

        na[j] = a[aj]

    a,na = na,a

    i += 1    

    k >>= 1



print((v+1))
# coding: utf-8
# Your code here!
import sys

read = sys.stdin.read
readline = sys.stdin.readline
n, k, *a = list(map(int, read().split()))
for i in range(n):
    a[i] -= 1


def pow2(a, n):
    if n == 0:
        return list(range(n))
    if n == 1:
        return a
    if n % 2:
        return mul(a, pow2(a, n - 1))
    else:
        x = pow2(a, n // 2)
        return mul(x, x)


def mul(a, b):
    return [a[bi] for bi in b]


x = pow2(a, k)
print((x[0] + 1))

# coding: utf-8
# Your code here!
import sys

read = sys.stdin.read
readline = sys.stdin.readline
n, k, *a = list(map(int, read().split()))
for i in range(n):
    a[i] -= 1
na = [0] * n
v = 0
while k:
    if k & 1:
        v = a[v]
    for j, aj in enumerate(a):
        na[j] = a[aj]
    a, na = na, a
    i += 1
    k >>= 1
print((v + 1))

- - -def pow2(a, n): -    if n == 0: -        return list(range(n)) -    if n == 1: -        return a -    if n % 2: -        return mul(a, pow2(a, n - 1)) -    else: -        x = pow2(a, n // 2) -        return mul(x, x) - - -def mul(a, b): -    return [a[bi] for bi in b] - - -x = pow2(a, k) -print((x[0] + 1)) +na = [0] * n +v = 0 +while k: +    if k & 1: +        v = a[v] +    for j, aj in enumerate(a): +        na[j] = a[aj] +    a, na = na, a +    i += 1 +    k >>= 1 +print((v + 1))