N,M=map(int,input().split()) p=[int(n) for n in input().split()] for i in range(M): print(i+1, p.count(i+1))