import collections
a,b=input().split()
c=map(int,input().split())
if __name__ == '__main__':
    n=list(c)
    c2 = [item for item, count in collections.Counter(n).items() if count>1]
print(sum(n)//int(b))
print(*c2)
    

