require 'matrix'

r, c = gets.split.map(&:to_i)
tmp = []
r.times do
  tmp << gets.split.map(&:to_i)
end
m = Matrix.rows(tmp, true)
tmp = []
c.times do
  tmp << gets.to_i
end
v = Vector[*tmp]
(m * v).each {|i| puts i }

