n, m = Array.new(2).map{gets.to_i}
target = gets.split(' ').map{|i| i.to_i-1}
score = Array.new(n){0}

m.times{ |i|
  game = gets.split(' ').map{|k| k.to_i-1}
  n.times{ |j|
    game[j] == target[i] ? score[j] += 1 : score[target[i]] += 1
  }
}

n.times { |i|
  puts score[i]
}