N, M = gets.split.map(&:to_i) L = gets.split.map(&:to_i) counter = Hash.new(0) L.each do |l| counter[l] += 1 end (1..M).each do |m| puts [m, counter[m]].join(' ') end