n,m=[int(e) for e in input().split()]
a=[int(e) for e in input().split()]
c={}
for x in a:
    if x not in c.keys():
        c[x]=1
    else:
        c[x]+=1
q=[x for x in c.keys() if c[x]>=n]
print(*q)
