n, m = map(int, input().split())
l = list(map(int, input().split()))
count = {}
for num in l:
    if num in count:
        count[num] += 1
    else:
        count[num] = 1
        
result = [key for key, value in count.items() if value >= n]
print(len(result))
for num in result:
    print(num, end=' ')
