inp = str(input()).split(" ")
inp2 = str(input()).split(" ")
out_array=[]

count=0
bool_array=[]
for s in inp2:
    bool_array=[]
    _continue=False
    for s1 in out_array:
        if s1==s:
            _continue=True
    if _continue:
        continue
    for s1 in inp2:
        if(s==s1):
            bool_array.append(True)
    if(len(bool_array)>=int(inp[0])):
        count+=1
        out_array.append(s)
print(count)
print(out_array)

