import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np N, M = map(int, readline().split()) L = np.array(read().split(), np.int32) counter = np.bincount(L, minlength=M + 1) for i, x in enumerate(counter[1: M + 1].tolist(), 1): print(i, x)