n,m = map(int, input().split())

cost = list(map(int, input().split()))

hashmap = {}

for i in range(len(cost)):
    try:
        hashmap[cost[i]] += 1
    except KeyError:
        hashmap[cost[i]] = 1

counter = 0
s = ""
for i in hashmap:
    if hashmap[i] >= n:
        s += f"{i} "
        counter += 1

print(counter)
print(s)
