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