n,m=map(int,input().split())
b=list(map(int,input().split()))
c=[]
for i in range(9):
    a=b.count(i)
    a1=a/n
    if a1>=1:
        j=b.index(i)
        c.append(b[j])
    a=0
print(len(c))
print(*c)
    


