n, m = map(int, input().split())
l2 =[]
l3 = []
s = input()
l = s.split()
clen2 = 0
l1 = int(l[0])

for i in range(1, len(l)):
    li = int(l[i])
    if li - l1 > 0:
        clen2 += 1 

for i in range(clen2 - 2):
    l2.append(0)

for i in range(clen2+1):
    d = int(l[i])
    l2[d] += 1


for i in range(len(l2)):
    if l2[i] >= n:
        l3.append(i)


print(len(l3))
print(*l3[1:], l3[0], sep=' ')