nm=list(map(int, input().split()))
costs=list(map(int, input().split()))
d, my_list ={}, []
for i in range(nm[1]):
    d[costs[i]] = d.get(costs[i], 0) + 1
for i,j in d.items():
    if j >= nm[0]:
        my_list.append(i)
print(len(my_list))
print(*(my_list))