n,k=map(int,input().split()) l=list(map(int,input().split())) a=[0]*(max(l)+1) for i in l: a[i]+=1 b=[str(i)+' '+str(a[i]) for i in range(1,k+1)] print('\n'.join(b))