# import numpy as np

# import queue

# import heapq





def main():

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

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



    f_loop = [1]

    passed = set(f_loop)



    next_idx = 1

    while True:

        next_town = As[next_idx-1]

        if next_town in passed:

            idx_head = f_loop.index(next_town)

            n_loop = len(f_loop) - idx_head

            break



        passed.add(next_town)

        f_loop.append(next_town)

        next_idx = next_town



    if idx_head + n_loop <= K:

        target = idx_head + (K - idx_head - n_loop) % n_loop

    else:

        target = K



    print((f_loop[target]))





if __name__ == "__main__":

    main()

def main():

    _, n_teleport = list(map(int, input().split()))

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



    visited_list = []

    visited_set = set()



    next_town = 1

    while 1:

        if next_town in visited_set:

            loop_start_at = visited_list.index(next_town)

            loop_length = len(visited_list) - loop_start_at

            break



        visited_list.append(next_town)

        visited_set.add(next_town)

        next_town = towns[next_town]



    if n_teleport < loop_start_at:

        end_point = n_teleport

    else:

        end_point = loop_start_at + (n_teleport - loop_start_at) % loop_length



    print((visited_list[end_point]))





if __name__ == "__main__":

    main()

# import numpy as np
# import queue
# import heapq
def main():
    N, K = list(map(int, input().split()))
    As = list(map(int, input().split()))
    f_loop = [1]
    passed = set(f_loop)
    next_idx = 1
    while True:
        next_town = As[next_idx - 1]
        if next_town in passed:
            idx_head = f_loop.index(next_town)
            n_loop = len(f_loop) - idx_head
            break
        passed.add(next_town)
        f_loop.append(next_town)
        next_idx = next_town
    if idx_head + n_loop <= K:
        target = idx_head + (K - idx_head - n_loop) % n_loop
    else:
        target = K
    print((f_loop[target]))


if __name__ == "__main__":
    main()

def main():
    _, n_teleport = list(map(int, input().split()))
    towns = [0] + list(map(int, input().split()))
    visited_list = []
    visited_set = set()
    next_town = 1
    while 1:
        if next_town in visited_set:
            loop_start_at = visited_list.index(next_town)
            loop_length = len(visited_list) - loop_start_at
            break
        visited_list.append(next_town)
        visited_set.add(next_town)
        next_town = towns[next_town]
    if n_teleport < loop_start_at:
        end_point = n_teleport
    else:
        end_point = loop_start_at + (n_teleport - loop_start_at) % loop_length
    print((visited_list[end_point]))


if __name__ == "__main__":
    main()

-# import numpy as np -# import queue -# import heapq -    N, K = list(map(int, input().split())) -    As = list(map(int, input().split())) -    f_loop = [1] -    passed = set(f_loop) -    next_idx = 1 -    while True: -        next_town = As[next_idx - 1] -        if next_town in passed: -            idx_head = f_loop.index(next_town) -            n_loop = len(f_loop) - idx_head +    _, n_teleport = list(map(int, input().split())) +    towns = [0] + list(map(int, input().split())) +    visited_list = [] +    visited_set = set() +    next_town = 1 +    while 1: +        if next_town in visited_set: +            loop_start_at = visited_list.index(next_town) +            loop_length = len(visited_list) - loop_start_at -        passed.add(next_town) -        f_loop.append(next_town) -        next_idx = next_town -    if idx_head + n_loop <= K: -        target = idx_head + (K - idx_head - n_loop) % n_loop +        visited_list.append(next_town) +        visited_set.add(next_town) +        next_town = towns[next_town] +    if n_teleport < loop_start_at: +        end_point = n_teleport -        target = K -    print((f_loop[target])) +        end_point = loop_start_at + (n_teleport - loop_start_at) % loop_length +    print((visited_list[end_point]))