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