from collections import Counter n,m=list(map(int, input().split())) c=Counter(list(map(int, input().split()))[::-1]) [print(i+1, c[i+1]) for i in range(m)]