n,m = map(int,input().split())
list_1 = list(map(int,input().split()))
set_l = set(list_1)
dict_1 = dict()
d = []
for i in range(len(list_1)):
    if list_1[i] not in dict_1:
        dict_1[list_1[i]] = 1
    else:
        dict_1[list_1[i]] += 1


for num in set_l:
    if dict_1[num] >= n:
        d.append(num)

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




