import bisect

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

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

seen = []

seen_sort = [1]

start = 1



while True:

    tmp = a[start - 1]

    seen.append(start)

    index = bisect.bisect_left(seen_sort, tmp)

    if index >= len(seen_sort) or seen_sort[index] != tmp:

        seen_sort.insert(index, tmp)

    else:

        repeat_index = seen.index(tmp)

        repeat_len = len(seen) - repeat_index

        break

    start = tmp



if k <= repeat_index:

    print((seen[k]))

else:

    print((seen[repeat_index + ((k - repeat_index) % repeat_len)]))
n, k = list(map(int, input().split()))

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

visited = []

visited_index = [-1] * n

pre = 0



while visited_index[pre] == -1:

    now = a[pre]

    visited.append(pre)

    visited_index[pre] = len(visited)

    pre = now - 1



loop = len(visited) - visited_index[pre] + 1

head = visited_index[pre] - 1



if k < head:

    print((visited[k] + 1))

else:

    k -= head

    k %= loop

    print((visited[head + k] + 1))
import bisect

n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
seen = []
seen_sort = [1]
start = 1
while True:
    tmp = a[start - 1]
    seen.append(start)
    index = bisect.bisect_left(seen_sort, tmp)
    if index >= len(seen_sort) or seen_sort[index] != tmp:
        seen_sort.insert(index, tmp)
    else:
        repeat_index = seen.index(tmp)
        repeat_len = len(seen) - repeat_index
        break
    start = tmp
if k <= repeat_index:
    print((seen[k]))
else:
    print((seen[repeat_index + ((k - repeat_index) % repeat_len)]))

n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
visited = []
visited_index = [-1] * n
pre = 0
while visited_index[pre] == -1:
    now = a[pre]
    visited.append(pre)
    visited_index[pre] = len(visited)
    pre = now - 1
loop = len(visited) - visited_index[pre] + 1
head = visited_index[pre] - 1
if k < head:
    print((visited[k] + 1))
else:
    k -= head
    k %= loop
    print((visited[head + k] + 1))

-import bisect - -seen = [] -seen_sort = [1] -start = 1 -while True: -    tmp = a[start - 1] -    seen.append(start) -    index = bisect.bisect_left(seen_sort, tmp) -    if index >= len(seen_sort) or seen_sort[index] != tmp: -        seen_sort.insert(index, tmp) -    else: -        repeat_index = seen.index(tmp) -        repeat_len = len(seen) - repeat_index -        break -    start = tmp -if k <= repeat_index: -    print((seen[k])) +visited = [] +visited_index = [-1] * n +pre = 0 +while visited_index[pre] == -1: +    now = a[pre] +    visited.append(pre) +    visited_index[pre] = len(visited) +    pre = now - 1 +loop = len(visited) - visited_index[pre] + 1 +head = visited_index[pre] - 1 +if k < head: +    print((visited[k] + 1)) -    print((seen[repeat_index + ((k - repeat_index) % repeat_len)])) +    k -= head +    k %= loop +    print((visited[head + k] + 1))