n, m = map(int, input().split())
s = [int(i) for i in input().split()]
s1 = []
for i in range(m):
    if s[i] not in s1:
        s1.append(s[i])
        if s.count(s[i]) >= n:
            print(s[i], end = ' ')