N, M = map(int, input().split()) L = list(map(int, input().split())) for i in range(M): print(i+1, L.count(i+1))