n,m=map(int,input().split()) l=list(map(int,input().split())) s=[] for i in range(1,m+1): s+=[str(i)+' '+str(l.count(i))] print('\n'.join(s))