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


A = [int(i) for i in input().split()]
string = ''
s = 0
result = {i: A.count(i) for i in A};
for key, value in result.items():
  if(value >= n):
    s += 1
    string += str(key)
    string += ' '
print(s)
print(string)