n = input().split()

a = n[0]

c = input().split()
e = []
for i in range(int(n[1])):
    r = c[i]
    j = c.count(r)
    if j >= int(a):
        if c[i] not in e:
            e += c[i]

print(len(e))
t_str = ""
for i in e:
    t_str += i + " "
print(t_str)
    

     

