from collections import Counter

n,m = map(int, input().split())
c = [int(a) for a in input().split()]
set = set()

for i in c:
    if c.count(i) >= n: set.add(i)

print(len(set))
print(' '.join(map(str, set)))