def main(input = STDIN)
  n = input.gets.to_i
  score = Array.new(n, 0)
  m = input.gets.to_i
  a = input.gets.split(" ").map(&:to_i)
  a.each do |i|
    b = input.gets.split(" ").map(&:to_i)
    score[i - 1] += n
    b.each_with_index do |j, idx|
      if i == j
        score[idx] += 1
        score[i - 1] -= 1
      end
    end
  end
  puts score
end
main