import sys



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

ara = [0]

ara += list(map(int, input().split()))



now = 1

vis = []

taken = [0]*(n+1)



while taken[now] == 0:

    vis.append(now)

    taken[now] = 1

    now = ara[now]



cycleLen = len(vis) - vis.index(now)



if k < vis.index(now):

    print((vis[k]))

    sys.exit()



k -= vis.index(now)

k %= cycleLen



print((vis[k + vis.index(now)]))
N, K = list(map(int, input().split()))

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



# mp = dict()

# for ix in range(N):

#     mp[ix+1] = A[ix]



hist = []

exists = [0] * (N+1)

cur = 1

cnt = 0



# ここがおかしい?

# while True:

#     cur = mp[cur]

#     cnt += 1

#     # K -= 1



#     if exists[cur] != 0:

#         break

#     else:

#         exists[cur] = 1

#         hist.append(cur)



A = [0] + A

# print(A)

while exists[cur] == 0:

    hist.append(cur)

    exists[cur] = 1

    cur = A[cur]



cycle_sp = cur

# cycle_l = 0

cycle_sp_ix = hist.index(cycle_sp)



import sys

if K < cycle_sp_ix:

    print((hist[K]))

    sys.exit()



cycle_l = len(hist) - cycle_sp_ix

# while True:

#     cur = mp[cur]

#     cycle_l += 1



#     if cur == cycle_sp:

#         break



rest = (K-cycle_sp_ix) % cycle_l

# print("cnt:", cnt)



# print("K:", K)

# print("cycle_l:", cycle_l)

# print("rest:", rest)



print((hist[rest + cycle_sp_ix]))

# while rest != 0:

#     cur = mp[cur]

#     rest -= 1



# print(cur)









"""

# hist = [1]

hist = {1: 0}

while True:



    hk = hist.keys()[-1]



    if not mp[hk] in hist.keys():

        # hist.append(mp[hist[-1]])

        hist[mp[hk]] = 0



    else:

        # found

        cstart = hist.index(mp[hk])

        cend = len(hist)

        cycle_l = cend - cstart

        # print("hist:", hist)

        # print("cstart:", cstart)

        # print("cend:", cend)

        # print("cycle_l:", cycle_l)



        ans_i = (K - cstart) % cycle_l

        # print("ans_i:", ans_i)

        ans = hist[cstart + ans_i]



        print(ans)

        break

"""
import sys

n, k = list(map(int, input().split()))
ara = [0]
ara += list(map(int, input().split()))
now = 1
vis = []
taken = [0] * (n + 1)
while taken[now] == 0:
    vis.append(now)
    taken[now] = 1
    now = ara[now]
cycleLen = len(vis) - vis.index(now)
if k < vis.index(now):
    print((vis[k]))
    sys.exit()
k -= vis.index(now)
k %= cycleLen
print((vis[k + vis.index(now)]))

N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
# mp = dict()
# for ix in range(N):
#     mp[ix+1] = A[ix]
hist = []
exists = [0] * (N + 1)
cur = 1
cnt = 0
# ここがおかしい?
# while True:
#     cur = mp[cur]
#     cnt += 1
#     # K -= 1
#     if exists[cur] != 0:
#         break
#     else:
#         exists[cur] = 1
#         hist.append(cur)
A = [0] + A
# print(A)
while exists[cur] == 0:
    hist.append(cur)
    exists[cur] = 1
    cur = A[cur]
cycle_sp = cur
# cycle_l = 0
cycle_sp_ix = hist.index(cycle_sp)
import sys

if K < cycle_sp_ix:
    print((hist[K]))
    sys.exit()
cycle_l = len(hist) - cycle_sp_ix
# while True:
#     cur = mp[cur]
#     cycle_l += 1
#     if cur == cycle_sp:
#         break
rest = (K - cycle_sp_ix) % cycle_l
# print("cnt:", cnt)
# print("K:", K)
# print("cycle_l:", cycle_l)
# print("rest:", rest)
print((hist[rest + cycle_sp_ix]))
# while rest != 0:
#     cur = mp[cur]
#     rest -= 1
# print(cur)
"""
# hist = [1]
hist = {1: 0}
while True:
    hk = hist.keys()[-1]
    if not mp[hk] in hist.keys():
        # hist.append(mp[hist[-1]])
        hist[mp[hk]] = 0
    else:
        # found
        cstart = hist.index(mp[hk])
        cend = len(hist)
        cycle_l = cend - cstart
        # print("hist:", hist)
        # print("cstart:", cstart)
        # print("cend:", cend)
        # print("cycle_l:", cycle_l)
        ans_i = (K - cstart) % cycle_l
        # print("ans_i:", ans_i)
        ans = hist[cstart + ans_i]
        print(ans)
        break
"""

+N, K = list(map(int, input().split())) +A = list(map(int, input().split())) +# mp = dict() +# for ix in range(N): +#     mp[ix+1] = A[ix] +hist = [] +exists = [0] * (N + 1) +cur = 1 +cnt = 0 +# ここがおかしい? +# while True: +#     cur = mp[cur] +#     cnt += 1 +#     # K -= 1 +#     if exists[cur] != 0: +#         break +#     else: +#         exists[cur] = 1 +#         hist.append(cur) +A = [0] + A +# print(A) +while exists[cur] == 0: +    hist.append(cur) +    exists[cur] = 1 +    cur = A[cur] +cycle_sp = cur +# cycle_l = 0 +cycle_sp_ix = hist.index(cycle_sp) -n, k = list(map(int, input().split())) -ara = [0] -ara += list(map(int, input().split())) -now = 1 -vis = [] -taken = [0] * (n + 1) -while taken[now] == 0: -    vis.append(now) -    taken[now] = 1 -    now = ara[now] -cycleLen = len(vis) - vis.index(now) -if k < vis.index(now): -    print((vis[k])) +if K < cycle_sp_ix: +    print((hist[K])) -k -= vis.index(now) -k %= cycleLen -print((vis[k + vis.index(now)])) +cycle_l = len(hist) - cycle_sp_ix +# while True: +#     cur = mp[cur] +#     cycle_l += 1 +#     if cur == cycle_sp: +#         break +rest = (K - cycle_sp_ix) % cycle_l +# print("cnt:", cnt) +# print("K:", K) +# print("cycle_l:", cycle_l) +# print("rest:", rest) +print((hist[rest + cycle_sp_ix])) +# while rest != 0: +#     cur = mp[cur] +#     rest -= 1 +# print(cur) +""" +# hist = [1] +hist = {1: 0} +while True: +    hk = hist.keys()[-1] +    if not mp[hk] in hist.keys(): +        # hist.append(mp[hist[-1]]) +        hist[mp[hk]] = 0 +    else: +        # found +        cstart = hist.index(mp[hk]) +        cend = len(hist) +        cycle_l = cend - cstart +        # print("hist:", hist) +        # print("cstart:", cstart) +        # print("cend:", cend) +        # print("cycle_l:", cycle_l) +        ans_i = (K - cstart) % cycle_l +        # print("ans_i:", ans_i) +        ans = hist[cstart + ans_i] +        print(ans) +        break +"""