from collections import Counter as c;_,m,*l=map(int,open(0).read().split());a=c(l[::-1]);[print(i+1,a[i+1])for i in range(m)]