s=gets.chomp.split(" ") num=s[1].to_i ary=gets.chomp.split(" ") ary.map!{|x|x.to_i} ary=ary.group_by(&:itself) (1..n).each do |n| if ary[n]==nil puts "#{n} 0" else puts "#{n} #{ary[n].count}" end end