n,m=list(map(int, input().split())) l=list(map(int, input().split())) [print(i+1, l.count(i+1)) for i in range(m)]