n = gets.to_i
m = gets.to_i
target = gets.split.map(&:to_i)
score = [0] * n 

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

puts score