n, m = map(int, input().split())
arr1 = input().split()
arr2 = {}
for i in arr1:
    if i not in arr2.keys():
        arr2[i] = 1
    else:
        arr2[i] += 1

ans = []
for i in arr2.keys():
    if arr2[i] >= n:
        ans.append(i)
print(len(ans))
print(*ans)
