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

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

turn = [-1] * (N+1) # いつ訪問したかを記録する

c = 1

for k in range(K):

    if turn[c]!=-1:

        T = k - turn[c] # 周期

        bias = turn[c] # バイアス

        break

    turn[c] = k

    c = A[c]

else:

    print (c)

    exit()



K -= bias 

K %= T

K += bias

c = 1 

for k in range(K):# 小さくしたKでシミュレーションし直す

    c = A[c]

print (c)
def MI(): return list(map(int, input().split()))

def LI(): return list(map(int, input().split()))

N,K=MI()

A=[0]+LI()

c=1

turn=[-1]*(N+1)

for k in range(K):

  if turn[c]!=-1:

    T=k-turn[c]

    bias=turn[c]

    break

  turn[c]=k

  c=A[c]

else:

  print(c)

  exit()

K-=bias

K%=T

K+=bias

c=1

for k in range(K):

  c=A[c]

print(c)
N, K = list(map(int, input().split()))
A = [0] + list(map(int, input().split()))
turn = [-1] * (N + 1)  # いつ訪問したかを記録する
c = 1
for k in range(K):
    if turn[c] != -1:
        T = k - turn[c]  # 周期
        bias = turn[c]  # バイアス
        break
    turn[c] = k
    c = A[c]
else:
    print(c)
    exit()
K -= bias
K %= T
K += bias
c = 1
for k in range(K):  # 小さくしたKでシミュレーションし直す
    c = A[c]
print(c)

def MI():
    return list(map(int, input().split()))


def LI():
    return list(map(int, input().split()))


N, K = MI()
A = [0] + LI()
c = 1
turn = [-1] * (N + 1)
for k in range(K):
    if turn[c] != -1:
        T = k - turn[c]
        bias = turn[c]
        break
    turn[c] = k
    c = A[c]
else:
    print(c)
    exit()
K -= bias
K %= T
K += bias
c = 1
for k in range(K):
    c = A[c]
print(c)

-N, K = list(map(int, input().split())) -A = [0] + list(map(int, input().split())) -turn = [-1] * (N + 1)  # いつ訪問したかを記録する +def MI(): +    return list(map(int, input().split())) + + +def LI(): +    return list(map(int, input().split())) + + +N, K = MI() +A = [0] + LI() +turn = [-1] * (N + 1) -        T = k - turn[c]  # 周期 -        bias = turn[c]  # バイアス +        T = k - turn[c] +        bias = turn[c] -for k in range(K):  # 小さくしたKでシミュレーションし直す +for k in range(K):