A = Array.new
b = Array.new
n, m = gets.split.map(&:to_i)
n.times {A << gets.split.map(&:to_i)}
m.times {b << gets.to_i}
  
A.each do |is|
  j = sum = 0
  is.each do |i|
    sum += i * b[j]
    j += 1
  end
  puts sum
end