from collections import Counter
n, m = map(int, input().split())
a = list(map(int, input().split()))
counter = Counter(a)

d = [key for key, value in counter.items() if value >= n]

print(len(d))
print(*d)

    
