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