def main():

    N, K = (int(i) for i in input().split())

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

    d = []

    d_set = set()

    s = 1

    for _ in range(N):

        if s in d_set:

            if K < len(d):

                return print(d[K])

            idx = d.index(s)

            K -= idx

            d = d[idx:]

            break

        d.append(s)

        d_set.add(s)

        s = A[s-1]



    # print(idx, d)

    K %= len(d)

    print(d[K])





if __name__ == '__main__':

    main()

def main():

    N, K = (int(i) for i in input().split())

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

    d = [-1]*(N+1)

    v = 1

    i = 0

    while d[v] == -1:

        d[v] = i

        v = A[v-1]

        i += 1

    c_length = i - d[v]  # 閉路長

    pre_c_length = d[v]

    if K < i:

        return print(d.index(K))

    else:

        K -= pre_c_length

        K %= c_length

        return print(d.index(pre_c_length+K))





if __name__ == '__main__':

    main()

def main():
    N, K = (int(i) for i in input().split())
    A = [int(i) for i in input().split()]
    d = []
    d_set = set()
    s = 1
    for _ in range(N):
        if s in d_set:
            if K < len(d):
                return print(d[K])
            idx = d.index(s)
            K -= idx
            d = d[idx:]
            break
        d.append(s)
        d_set.add(s)
        s = A[s - 1]
    # print(idx, d)
    K %= len(d)
    print(d[K])


if __name__ == "__main__":
    main()

def main():
    N, K = (int(i) for i in input().split())
    A = [int(i) for i in input().split()]
    d = [-1] * (N + 1)
    v = 1
    i = 0
    while d[v] == -1:
        d[v] = i
        v = A[v - 1]
        i += 1
    c_length = i - d[v]  # 閉路長
    pre_c_length = d[v]
    if K < i:
        return print(d.index(K))
    else:
        K -= pre_c_length
        K %= c_length
        return print(d.index(pre_c_length + K))


if __name__ == "__main__":
    main()

-    d = [] -    d_set = set() -    s = 1 -    for _ in range(N): -        if s in d_set: -            if K < len(d): -                return print(d[K]) -            idx = d.index(s) -            K -= idx -            d = d[idx:] -            break -        d.append(s) -        d_set.add(s) -        s = A[s - 1] -    # print(idx, d) -    K %= len(d) -    print(d[K]) +    d = [-1] * (N + 1) +    v = 1 +    i = 0 +    while d[v] == -1: +        d[v] = i +        v = A[v - 1] +        i += 1 +    c_length = i - d[v]  # 閉路長 +    pre_c_length = d[v] +    if K < i: +        return print(d.index(K)) +    else: +        K -= pre_c_length +        K %= c_length +        return print(d.index(pre_c_length + K))