def main():

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

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

    visited = [0 for i in range(n)]

    visit = [0]

    visited[0]=1

    s = 0

    while True:

        s = a[s]-1

        if visited[s]==1:

            x = visit[0:visit.index(s)]

            y = visit[visit.index(s):]

            break

        visit.append(s)

        visited[s]=1



    if k<len(x):

        print((x[k]+1))

    else:

        k = k-len(x)

        print((y[k%len(y)]+1))





if __name__ == "__main__":

    main()

def main():

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

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

    vis = [0 for i in range(n)]

    vis[0] = 1

    fst = [1]

    st = a[0]-1

    while True:

        if vis[st] == 0:

            vis[st] = 1

            fst.append(st+1)

            st = a[st]-1

        else:

            st = fst.index(st+1)

            loop = fst[st:]

            break

    if k < len(fst):

        print((fst[k]))

    else:

        k = k - len(fst) + 1

        k = k%len(loop)

        print((loop[k-1]))

    



if __name__ == "__main__":

    main()

def main():
    n, k = list(map(int, input().split()))
    a = list(map(int, input().split()))
    visited = [0 for i in range(n)]
    visit = [0]
    visited[0] = 1
    s = 0
    while True:
        s = a[s] - 1
        if visited[s] == 1:
            x = visit[0 : visit.index(s)]
            y = visit[visit.index(s) :]
            break
        visit.append(s)
        visited[s] = 1
    if k < len(x):
        print((x[k] + 1))
    else:
        k = k - len(x)
        print((y[k % len(y)] + 1))


if __name__ == "__main__":
    main()

def main():
    n, k = list(map(int, input().split()))
    a = list(map(int, input().split()))
    vis = [0 for i in range(n)]
    vis[0] = 1
    fst = [1]
    st = a[0] - 1
    while True:
        if vis[st] == 0:
            vis[st] = 1
            fst.append(st + 1)
            st = a[st] - 1
        else:
            st = fst.index(st + 1)
            loop = fst[st:]
            break
    if k < len(fst):
        print((fst[k]))
    else:
        k = k - len(fst) + 1
        k = k % len(loop)
        print((loop[k - 1]))


if __name__ == "__main__":
    main()

-    visited = [0 for i in range(n)] -    visit = [0] -    visited[0] = 1 -    s = 0 +    vis = [0 for i in range(n)] +    vis[0] = 1 +    fst = [1] +    st = a[0] - 1 -        s = a[s] - 1 -        if visited[s] == 1: -            x = visit[0 : visit.index(s)] -            y = visit[visit.index(s) :] +        if vis[st] == 0: +            vis[st] = 1 +            fst.append(st + 1) +            st = a[st] - 1 +        else: +            st = fst.index(st + 1) +            loop = fst[st:] -        visit.append(s) -        visited[s] = 1 -    if k < len(x): -        print((x[k] + 1)) +    if k < len(fst): +        print((fst[k])) -        k = k - len(x) -        print((y[k % len(y)] + 1)) +        k = k - len(fst) + 1 +        k = k % len(loop) +        print((loop[k - 1]))