a,b = map(int,input().split())
c = ([0]*b)
c = list(map(int, input().split()))
v = []
m = []
for i in range(b):
    if list.count(m, c[i]) == 0:
        list.append(m, c[i])
for i in range(len(m)):
    if list.count(c, m[i]) > a-1:
        list.append(v, m[i])
s = ''
for i in range(len(v)-1):
    s += str(v[i]) + " "
s += str(v[len(v)-1])
print(len(v))
print(s)
