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

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



B = [1] + [A[1]]

S = set(B)

i = 1

while i+1 == len(S):

    B.append(A[B[i]])

    S.add(A[B[i]])

    i += 1



for i in range(len(B)-1):

    if B[i] == B[-1]:

        a = i

        break



if K <= a:

    print((B[K]))

else:

    print((B[a+ ((K-a) % (len(B)-a-1))]))
import sys



sys.setrecursionlimit(10**7)

def I(): return int(sys.stdin.readline().rstrip())

def MI(): return list(map(int,sys.stdin.readline().rstrip().split()))

def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり

def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし

def S(): return sys.stdin.readline().rstrip()

def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり

def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし





N,K = MI()

A = [0] + LI()



visited = [0]*(N+1)

times = [0]*(N+1)

i = 1

a = 0

visited[1] = 0

times[0] = 1

while True:

    i = A[i]

    a += 1

    if visited[i] != 0:

        times[a] = i

        b,c = visited[i],a

        break

    else:

        visited[i] = a

        times[a] = i





if K <= a:

    print((times[K]))

else:

    print((times[a+(K-a)%(b-a)]))

N, K = list(map(int, input().split()))
A = [0] + list(map(int, input().split()))
B = [1] + [A[1]]
S = set(B)
i = 1
while i + 1 == len(S):
    B.append(A[B[i]])
    S.add(A[B[i]])
    i += 1
for i in range(len(B) - 1):
    if B[i] == B[-1]:
        a = i
        break
if K <= a:
    print((B[K]))
else:
    print((B[a + ((K - a) % (len(B) - a - 1))]))

import sys

sys.setrecursionlimit(10**7)


def I():
    return int(sys.stdin.readline().rstrip())


def MI():
    return list(map(int, sys.stdin.readline().rstrip().split()))


def LI():
    return list(map(int, sys.stdin.readline().rstrip().split()))  # 空白あり


def LI2():
    return list(map(int, sys.stdin.readline().rstrip()))  # 空白なし


def S():
    return sys.stdin.readline().rstrip()


def LS():
    return list(sys.stdin.readline().rstrip().split())  # 空白あり


def LS2():
    return list(sys.stdin.readline().rstrip())  # 空白なし


N, K = MI()
A = [0] + LI()
visited = [0] * (N + 1)
times = [0] * (N + 1)
i = 1
a = 0
visited[1] = 0
times[0] = 1
while True:
    i = A[i]
    a += 1
    if visited[i] != 0:
        times[a] = i
        b, c = visited[i], a
        break
    else:
        visited[i] = a
        times[a] = i
if K <= a:
    print((times[K]))
else:
    print((times[a + (K - a) % (b - a)]))

-N, K = list(map(int, input().split())) -A = [0] + list(map(int, input().split())) -B = [1] + [A[1]] -S = set(B) +import sys + +sys.setrecursionlimit(10**7) + + +def I(): +    return int(sys.stdin.readline().rstrip()) + + +def MI(): +    return list(map(int, sys.stdin.readline().rstrip().split())) + + +def LI(): +    return list(map(int, sys.stdin.readline().rstrip().split()))  # 空白あり + + +def LI2(): +    return list(map(int, sys.stdin.readline().rstrip()))  # 空白なし + + +def S(): +    return sys.stdin.readline().rstrip() + + +def LS(): +    return list(sys.stdin.readline().rstrip().split())  # 空白あり + + +def LS2(): +    return list(sys.stdin.readline().rstrip())  # 空白なし + + +N, K = MI() +A = [0] + LI() +visited = [0] * (N + 1) +times = [0] * (N + 1) -while i + 1 == len(S): -    B.append(A[B[i]]) -    S.add(A[B[i]]) -    i += 1 -for i in range(len(B) - 1): -    if B[i] == B[-1]: -        a = i +a = 0 +visited[1] = 0 +times[0] = 1 +while True: +    i = A[i] +    a += 1 +    if visited[i] != 0: +        times[a] = i +        b, c = visited[i], a +    else: +        visited[i] = a +        times[a] = i -    print((B[K])) +    print((times[K])) -    print((B[a + ((K - a) % (len(B) - a - 1))])) +    print((times[a + (K - a) % (b - a)]))