n, m = gets.split.map(&:to_i)
ary1 = []
ary2 = []
n.times do
    ary1 << gets.split.map(&:to_i)
end
m.times do
    ary2 << gets.to_i
end

(0..n-1).each do |i|
    sum = 0
    (0..m-1).each do |j|
        sum += ary1[i][j] * ary2[j] if ary2[j]
    end
    puts sum
end
