from itertools import groupby
nm = input('')
nm = nm.split()
n = nm[0]
m = nm[1]
prices = input('')
prices = prices.split()
repeated_elements = []
for element in prices:
    if prices.count(element) >= int(n) and element not in repeated_elements:
        repeated_elements.append(element)
repeatednumber = len(repeated_elements)
print(repeatednumber)
print(*repeated_elements)