



def solve():

    hm = {}

    steps = k

    curr = 0

    loopsize = 0

    pre = 0

    while not str(curr) in hm and steps > 0:

        hm[str(curr)] = pre

        pre+=1

        curr = a[curr] - 1

        steps -= 1

        loopsize += 1

    if str(curr) in hm:

        loopsize -= hm[str(curr)]

    steps %= loopsize

    while steps > 0:

        curr = a[curr] - 1

        steps -= 1

    print((curr + 1))

    return







n, k = [int(i) for i in input().split(" ")]

a = [int(i) for i in input().split(" ")]

solve()

import sys



if sys.subversion[0] == "PyPy":

    import io, atexit



    sys.stdout = io.BytesIO()

    atexit.register(lambda: sys.__stdout__.write(sys.stdout.getvalue()))



    sys.stdin = io.BytesIO(sys.stdin.read())

    input = lambda: sys.stdin.readline().rstrip()

RS = raw_input

RA = lambda x=int: list(map(x, RS().split()))

RN = lambda x=int: x(RS())





def solve():

    curr = 1

    left = k

    vis = {}

    while left > 0:

        curr = a[curr-1]

        left -= 1

        if not curr in vis:

            vis[curr] = k - left

        else:

            loopsize = k - left - vis[curr]

            left %= loopsize

            break

    while left > 0:

        curr = a[curr-1]

        left -= 1

    print(curr)





    return











n, k = RA()

a = RA()

solve()



def solve():
    hm = {}
    steps = k
    curr = 0
    loopsize = 0
    pre = 0
    while not str(curr) in hm and steps > 0:
        hm[str(curr)] = pre
        pre += 1
        curr = a[curr] - 1
        steps -= 1
        loopsize += 1
    if str(curr) in hm:
        loopsize -= hm[str(curr)]
    steps %= loopsize
    while steps > 0:
        curr = a[curr] - 1
        steps -= 1
    print((curr + 1))
    return


n, k = [int(i) for i in input().split(" ")]
a = [int(i) for i in input().split(" ")]
solve()

import sys

if sys.subversion[0] == "PyPy":
    import io, atexit

    sys.stdout = io.BytesIO()
    atexit.register(lambda: sys.__stdout__.write(sys.stdout.getvalue()))
    sys.stdin = io.BytesIO(sys.stdin.read())
    input = lambda: sys.stdin.readline().rstrip()
RS = raw_input
RA = lambda x=int: list(map(x, RS().split()))
RN = lambda x=int: x(RS())


def solve():
    curr = 1
    left = k
    vis = {}
    while left > 0:
        curr = a[curr - 1]
        left -= 1
        if not curr in vis:
            vis[curr] = k - left
        else:
            loopsize = k - left - vis[curr]
            left %= loopsize
            break
    while left > 0:
        curr = a[curr - 1]
        left -= 1
    print(curr)
    return


n, k = RA()
a = RA()
solve()

+import sys + +if sys.subversion[0] == "PyPy": +    import io, atexit + +    sys.stdout = io.BytesIO() +    atexit.register(lambda: sys.__stdout__.write(sys.stdout.getvalue())) +    sys.stdin = io.BytesIO(sys.stdin.read()) +    input = lambda: sys.stdin.readline().rstrip() +RS = raw_input +RA = lambda x=int: list(map(x, RS().split())) +RN = lambda x=int: x(RS()) + + -    hm = {} -    steps = k -    curr = 0 -    loopsize = 0 -    pre = 0 -    while not str(curr) in hm and steps > 0: -        hm[str(curr)] = pre -        pre += 1 -        curr = a[curr] - 1 -        steps -= 1 -        loopsize += 1 -    if str(curr) in hm: -        loopsize -= hm[str(curr)] -    steps %= loopsize -    while steps > 0: -        curr = a[curr] - 1 -        steps -= 1 -    print((curr + 1)) +    curr = 1 +    left = k +    vis = {} +    while left > 0: +        curr = a[curr - 1] +        left -= 1 +        if not curr in vis: +            vis[curr] = k - left +        else: +            loopsize = k - left - vis[curr] +            left %= loopsize +            break +    while left > 0: +        curr = a[curr - 1] +        left -= 1 +    print(curr) -n, k = [int(i) for i in input().split(" ")] -a = [int(i) for i in input().split(" ")] +n, k = RA() +a = RA()