import sys

read = sys.stdin.read

readline = sys.stdin.readline

readlines = sys.stdin.readlines



def main():

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

    A = [int(i) for i in readline().split()]



    d = [0] * (N+1)

    d[1] = 1

    now = 1

    next_ = A[0]

    c = [0] * (N+1)

    cnt = 0

    while d[next_] == 0:

        d[next_] = d[now] + 1

        now = next_

        next_ = A[next_-1]

        cnt += 1

        c[now] = cnt



    s = c[next_]

    loop = cnt - s



    if K <= s:

        ans = c[1:].index(K) + 1

    else:

        n = (K - s) % (loop + 1)

        ans = c[1:].index(s + n) + 1

    

    print(ans)





if __name__ == "__main__":

    main()

import sys

read = sys.stdin.read

readline = sys.stdin.readline

readlines = sys.stdin.readlines



def main():

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

    A = [int(i) - 1 for i in readline().split()]



    p = 0

    route = []

    seen = set()

    while True:

        route.append(p)

        seen.add(p)

        p = A[p]

        if p in seen:

            break

    

    loop_start = route.index(p)

    loop_len = len(route) - loop_start



    if K <= loop_start:

        ans = route[K] + 1

    else:

        r = (K - loop_start) % loop_len

        ans = route[loop_start + r] + 1

    

    print(ans)





if __name__ == "__main__":

    main()

import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines


def main():
    N, K = list(map(int, readline().split()))
    A = [int(i) for i in readline().split()]
    d = [0] * (N + 1)
    d[1] = 1
    now = 1
    next_ = A[0]
    c = [0] * (N + 1)
    cnt = 0
    while d[next_] == 0:
        d[next_] = d[now] + 1
        now = next_
        next_ = A[next_ - 1]
        cnt += 1
        c[now] = cnt
    s = c[next_]
    loop = cnt - s
    if K <= s:
        ans = c[1:].index(K) + 1
    else:
        n = (K - s) % (loop + 1)
        ans = c[1:].index(s + n) + 1
    print(ans)


if __name__ == "__main__":
    main()

import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines


def main():
    N, K = list(map(int, readline().split()))
    A = [int(i) - 1 for i in readline().split()]
    p = 0
    route = []
    seen = set()
    while True:
        route.append(p)
        seen.add(p)
        p = A[p]
        if p in seen:
            break
    loop_start = route.index(p)
    loop_len = len(route) - loop_start
    if K <= loop_start:
        ans = route[K] + 1
    else:
        r = (K - loop_start) % loop_len
        ans = route[loop_start + r] + 1
    print(ans)


if __name__ == "__main__":
    main()

-    A = [int(i) for i in readline().split()] -    d = [0] * (N + 1) -    d[1] = 1 -    now = 1 -    next_ = A[0] -    c = [0] * (N + 1) -    cnt = 0 -    while d[next_] == 0: -        d[next_] = d[now] + 1 -        now = next_ -        next_ = A[next_ - 1] -        cnt += 1 -        c[now] = cnt -    s = c[next_] -    loop = cnt - s -    if K <= s: -        ans = c[1:].index(K) + 1 +    A = [int(i) - 1 for i in readline().split()] +    p = 0 +    route = [] +    seen = set() +    while True: +        route.append(p) +        seen.add(p) +        p = A[p] +        if p in seen: +            break +    loop_start = route.index(p) +    loop_len = len(route) - loop_start +    if K <= loop_start: +        ans = route[K] + 1 -        n = (K - s) % (loop + 1) -        ans = c[1:].index(s + n) + 1 +        r = (K - loop_start) % loop_len +        ans = route[loop_start + r] + 1