"""a, b=map(int,input().split())
c=0
b=0
d=0
price = input().split()
price.sort()
for i in price:
    if i==c:
        b+=1
        d+=1
    if d==2:
        b=0
        d=0
    if b==1:
        print(i)
        b=0
    c=i
"""

n, m = map(int, input().split())
k = n + 1
print(k)
v = input().split()
for i in range(m):
    count = 0
    for j in range(i, m):
        if int(v[j]) == int(v[i]):
            count += 1
    if count == n:
        b = int(v[i])
        print(b, end=" ")