n, m = map(int, input().split())
c = list(map(int, input().split()))
count_dict = {}

for i in c:
    if i in count_dict:
        count_dict[i] += 1
    else:
        count_dict[i] = 1

t = []
for key, value in count_dict.items():
    if value >= n:
        t.append(key)

print(len(t))
print(*t)  
