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

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

s = set()

loop = []

ls = set()

pas1 = []

pas2 = []

now = 1

count = 0

if k == 1:

    print((l[0]))

    exit()

for i in range(2*n):

    a = l[now-1]

    if a in s:

        if a in ls:

            k -= count+1

            print((loop[k%len(loop)]))

            

            exit()

        else:

            ls.add(a)

            loop.append(a)

            now = a

            count += 1

            if count == k:

                print(a)

                exit()

        

        

    else:

        now = a

        s.add(a)

        count += 1

        pas1.append(a)

        

        if count == k:

            print(a)

            exit()

    

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

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

s = set()

s.add(1)

pas1 = [1]

pas2 = []

now = 1

count = 0

if k == 1:

    print((l[0]))

    exit()

for i in range(2*n):

    a = l[now-1]

    if a in s:

        index = pas1.index(a)

        k -= index

        le = len(pas1)-index

        print((pas1[k%le+index]))

        

        exit()

    else:

        now = a

        s.add(a)

        count += 1

        pas1.append(a)

        

        if count == k:

            print(a)

            exit()

    

n, k = list(map(int, input().split()))
l = list(map(int, input().split()))
s = set()
loop = []
ls = set()
pas1 = []
pas2 = []
now = 1
count = 0
if k == 1:
    print((l[0]))
    exit()
for i in range(2 * n):
    a = l[now - 1]
    if a in s:
        if a in ls:
            k -= count + 1
            print((loop[k % len(loop)]))
            exit()
        else:
            ls.add(a)
            loop.append(a)
            now = a
            count += 1
            if count == k:
                print(a)
                exit()
    else:
        now = a
        s.add(a)
        count += 1
        pas1.append(a)
        if count == k:
            print(a)
            exit()

n, k = list(map(int, input().split()))
l = list(map(int, input().split()))
s = set()
s.add(1)
pas1 = [1]
pas2 = []
now = 1
count = 0
if k == 1:
    print((l[0]))
    exit()
for i in range(2 * n):
    a = l[now - 1]
    if a in s:
        index = pas1.index(a)
        k -= index
        le = len(pas1) - index
        print((pas1[k % le + index]))
        exit()
    else:
        now = a
        s.add(a)
        count += 1
        pas1.append(a)
        if count == k:
            print(a)
            exit()

-loop = [] -ls = set() -pas1 = [] +s.add(1) +pas1 = [1] -        if a in ls: -            k -= count + 1 -            print((loop[k % len(loop)])) -            exit() -        else: -            ls.add(a) -            loop.append(a) -            now = a -            count += 1 -            if count == k: -                print(a) -                exit() +        index = pas1.index(a) +        k -= index +        le = len(pas1) - index +        print((pas1[k % le + index])) +        exit()