n = gets.to_i
m = gets.to_i
target = gets.split.map(&:to_i)
score = Array.new(n, 0)
m.times do |j|
  h = gets.split.map(&:to_i)
  n.times do |i|
    if h[i] == target[j] then score[i] += 1
    else score[target[j]-1] += 1
    end
  end
end
score.each{|v| p v}