n,m=map(int,input().split()) l=list(map(int,input().split())) l=sorted(l) for i in range(1,m+1): ans=l.count(i) print(i,ans) if ans > 0: l=l[ans:]