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

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



pos = 0

visit = [0]*n

move = []

roop = []

while visit[pos] != 2:

    if visit[pos] == 0:

        move.append(pos)

    else:

        roop.append(pos)

    visit[pos] += 1

    pos = a[pos] - 1

if len(move) > k:

    print((move[k]+1))

else:

    print((roop[(k-(len(move)-len(roop))) % len(roop)]+1))

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

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



num = 1

li = [1]

flag = [True]*n

flag[0] = False



for i in range(k):

    num = a[num-1]

    if flag[num-1]:

        li.append(num)

        flag[num-1] = False

    else:

        break



d = li.index(num)

ans = (k-d) % (len(li)-d)+d

print((li[ans]))

n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
pos = 0
visit = [0] * n
move = []
roop = []
while visit[pos] != 2:
    if visit[pos] == 0:
        move.append(pos)
    else:
        roop.append(pos)
    visit[pos] += 1
    pos = a[pos] - 1
if len(move) > k:
    print((move[k] + 1))
else:
    print((roop[(k - (len(move) - len(roop))) % len(roop)] + 1))

n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
num = 1
li = [1]
flag = [True] * n
flag[0] = False
for i in range(k):
    num = a[num - 1]
    if flag[num - 1]:
        li.append(num)
        flag[num - 1] = False
    else:
        break
d = li.index(num)
ans = (k - d) % (len(li) - d) + d
print((li[ans]))

-pos = 0 -visit = [0] * n -move = [] -roop = [] -while visit[pos] != 2: -    if visit[pos] == 0: -        move.append(pos) +num = 1 +li = [1] +flag = [True] * n +flag[0] = False +for i in range(k): +    num = a[num - 1] +    if flag[num - 1]: +        li.append(num) +        flag[num - 1] = False -        roop.append(pos) -    visit[pos] += 1 -    pos = a[pos] - 1 -if len(move) > k: -    print((move[k] + 1)) -else: -    print((roop[(k - (len(move) - len(roop))) % len(roop)] + 1)) +        break +d = li.index(num) +ans = (k - d) % (len(li) - d) + d +print((li[ans]))