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

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



table = {}

init_table = {}

move = {}



for i in range(N):

    if A[i] in table:

        move[table[A[i]]], move[i] = i+1, init_table[A[i]]+1

    else:

        if A[i] not in init_table:

            init_table[A[i]] = i

    table[A[i]] = i



T = K

idx = 0

remain = [0]

for i in range(1, K+1):

    while idx in move and idx < move[idx]:

        idx = move[idx]

    remain.append(idx)

    if(idx == N and i != K):

        T = K % i

        break

    if idx in move:

        idx = move[idx]

    else:

        idx += 1



if(T == 0):

    print()

    exit()

idx = remain[T]

ret = []

while idx < len(A):

    while idx in move and idx < move[idx]:

        idx = move[idx]

    if(idx < len(A)):

        ret.append(A[idx])

    idx += 1



print((*ret))



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

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



table = {}

init_table = {}

move = {}



for i in range(N):

    if A[i] in table:

        move[table[A[i]]], move[i] = i+1, init_table[A[i]]+1

    else:

        if A[i] not in init_table:

            init_table[A[i]] = i

    table[A[i]] = i



T = K

idx = 0

remain = [0]

for i in range(1, K+1):

    while idx in move and idx < move[idx]:

        idx = move[idx]

    remain.append(idx)

    if(idx == N and i != K):

        T = K % i

        break

    if idx in move:

        idx = move[idx]

    else:

        idx += 1



if(T == 0):

    print()

    exit()

idx = remain[T]

ret = []

while idx < len(A):

    while idx in move and idx < move[idx]:

        idx = move[idx]

    if(idx >= len(A)):

        break

    ret.append(A[idx])

    idx += 1



print((*ret))



N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
table = {}
init_table = {}
move = {}
for i in range(N):
    if A[i] in table:
        move[table[A[i]]], move[i] = i + 1, init_table[A[i]] + 1
    else:
        if A[i] not in init_table:
            init_table[A[i]] = i
    table[A[i]] = i
T = K
idx = 0
remain = [0]
for i in range(1, K + 1):
    while idx in move and idx < move[idx]:
        idx = move[idx]
    remain.append(idx)
    if idx == N and i != K:
        T = K % i
        break
    if idx in move:
        idx = move[idx]
    else:
        idx += 1
if T == 0:
    print()
    exit()
idx = remain[T]
ret = []
while idx < len(A):
    while idx in move and idx < move[idx]:
        idx = move[idx]
    if idx < len(A):
        ret.append(A[idx])
    idx += 1
print((*ret))

N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
table = {}
init_table = {}
move = {}
for i in range(N):
    if A[i] in table:
        move[table[A[i]]], move[i] = i + 1, init_table[A[i]] + 1
    else:
        if A[i] not in init_table:
            init_table[A[i]] = i
    table[A[i]] = i
T = K
idx = 0
remain = [0]
for i in range(1, K + 1):
    while idx in move and idx < move[idx]:
        idx = move[idx]
    remain.append(idx)
    if idx == N and i != K:
        T = K % i
        break
    if idx in move:
        idx = move[idx]
    else:
        idx += 1
if T == 0:
    print()
    exit()
idx = remain[T]
ret = []
while idx < len(A):
    while idx in move and idx < move[idx]:
        idx = move[idx]
    if idx >= len(A):
        break
    ret.append(A[idx])
    idx += 1
print((*ret))

-    if idx < len(A): -        ret.append(A[idx]) +    if idx >= len(A): +        break +    ret.append(A[idx])