import sys input = sys.stdin.buffer.readline N, M = map(lambda x: int(x), input().split()) Ls = list(map(int, input().split())) for i in range(1, M + 1): print(i, Ls.count(i))