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

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

a = [1] + a

def next(i):

    return a[i]



z = [0] * (n+1)



place = 1

T = 0

interval = 0

if k < n:

    for i in range(k):

        place = next(place)

    print(place);exit()

place = 0

k += 1

for i in range(n):

    place = next(place)

    if z[place] != 0:

        interval = T - z[place]  + 1

        break

    z[1] = 1 

    T += 1

    z[place] = T



m = (k-z[place])%interval

for i in range(m):

    place = next(place)

print(place)

import sys

sys.setrecursionlimit(10**8)

INF = float('inf')

mod = 10**9 + 7

input = sys.stdin.readline



def inp():

    return int(eval(input()))

def inpl():

    return list(map(int,input().split()))

def inpm():

    return list(map(int,input().split()))



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



a=[1] + inpl()

b=[-1] * (n+1); b[1] = 0

place = 1

turn = 0



while b[a[place]] == -1:

    place = a[place]

    turn += 1

    b[place] = turn

r = (k - turn) % (b[place] - b[a[place]] + 1)



if k < turn:

    print((b.index(k)))

else:

    for _ in range(r):

        place = a[place]

    print(place)



n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
a = [1] + a


def next(i):
    return a[i]


z = [0] * (n + 1)
place = 1
T = 0
interval = 0
if k < n:
    for i in range(k):
        place = next(place)
    print(place)
    exit()
place = 0
k += 1
for i in range(n):
    place = next(place)
    if z[place] != 0:
        interval = T - z[place] + 1
        break
    z[1] = 1
    T += 1
    z[place] = T
m = (k - z[place]) % interval
for i in range(m):
    place = next(place)
print(place)

import sys

sys.setrecursionlimit(10**8)
INF = float("inf")
mod = 10**9 + 7
input = sys.stdin.readline


def inp():
    return int(eval(input()))


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


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


n, k = list(map(int, input().split()))
a = [1] + inpl()
b = [-1] * (n + 1)
b[1] = 0
place = 1
turn = 0
while b[a[place]] == -1:
    place = a[place]
    turn += 1
    b[place] = turn
r = (k - turn) % (b[place] - b[a[place]] + 1)
if k < turn:
    print((b.index(k)))
else:
    for _ in range(r):
        place = a[place]
    print(place)

-n, k = list(map(int, input().split())) -a = list(map(int, input().split())) -a = [1] + a +import sys + +sys.setrecursionlimit(10**8) +INF = float("inf") +mod = 10**9 + 7 +input = sys.stdin.readline -def next(i): -    return a[i] +def inp(): +    return int(eval(input())) -z = [0] * (n + 1) +def inpl(): +    return list(map(int, input().split())) + + +def inpm(): +    return list(map(int, input().split())) + + +n, k = list(map(int, input().split())) +a = [1] + inpl() +b = [-1] * (n + 1) +b[1] = 0 -T = 0 -interval = 0 -if k < n: -    for i in range(k): -        place = next(place) +turn = 0 +while b[a[place]] == -1: +    place = a[place] +    turn += 1 +    b[place] = turn +r = (k - turn) % (b[place] - b[a[place]] + 1) +if k < turn: +    print((b.index(k))) +else: +    for _ in range(r): +        place = a[place] -    exit() -place = 0 -k += 1 -for i in range(n): -    place = next(place) -    if z[place] != 0: -        interval = T - z[place] + 1 -        break -    z[1] = 1 -    T += 1 -    z[place] = T -m = (k - z[place]) % interval -for i in range(m): -    place = next(place) -print(place)