n, m = gets.split.map(&:to_i)
array_a = Array.new(n)
array_b = Array.new(m)

n.times do |i|
  array_a[i] = gets.split.map(&:to_i)
end

m.times do |j|
  array_b[j] = gets.to_i
end

array_a.each do |a_sub|
  summary = a_sub.each_with_index.reduce(0) do |sum, (a, i)|
    sum += a * array_b[i]
  end
  puts summary
end
