a,b =map(int,input().split())
s = list(map(int,input().split()))
l=0
l1 = []
d = {}
for i in range(b):
    if s[i] not in d:
        d[s[i]] =1
    else:
        d[s[i]] +=1


for key,values in d.items():
    if values >= a:
        l1.append(key)
        l+=1
print(l)
print(*l1)


