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

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



s = [-1] * n

c = [1]

t = 0

now = 0

while s[now] == -1:

    s[now] = t

    now = a[now] - 1

    c.append(now+1)

    t += 1



start_cycle = c.index(c[-1])

loop = c[start_cycle:-1]

cycle = len(loop)



if k < start_cycle:

    print((c[k]))

else:

    k -= start_cycle

    k %= cycle

    print((loop[k]))
n, k = list(map(int,input().split()))

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



s = [False] * n

c = [1]

now = 0

while not s[now]:

    s[now] = True

    now = a[now] - 1

    c.append(now+1)



start_cycle = c.index(c[-1])

loop = c[start_cycle:-1]

cycle = len(loop)



if k < start_cycle:

    print((c[k]))

else:

    k -= start_cycle

    k %= cycle

    print((loop[k]))
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
s = [-1] * n
c = [1]
t = 0
now = 0
while s[now] == -1:
    s[now] = t
    now = a[now] - 1
    c.append(now + 1)
    t += 1
start_cycle = c.index(c[-1])
loop = c[start_cycle:-1]
cycle = len(loop)
if k < start_cycle:
    print((c[k]))
else:
    k -= start_cycle
    k %= cycle
    print((loop[k]))

n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
s = [False] * n
c = [1]
now = 0
while not s[now]:
    s[now] = True
    now = a[now] - 1
    c.append(now + 1)
start_cycle = c.index(c[-1])
loop = c[start_cycle:-1]
cycle = len(loop)
if k < start_cycle:
    print((c[k]))
else:
    k -= start_cycle
    k %= cycle
    print((loop[k]))

-s = [-1] * n +s = [False] * n -t = 0 -while s[now] == -1: -    s[now] = t +while not s[now]: +    s[now] = True -    t += 1