r,c = gets.chomp.split(" ").map &:to_i

m = Array.new(r+1)
r.times { |i|
  m[i] = gets.chomp.split(" ").map &:to_i
}

m[r] = Array.new(c)
c.times { |i| m[r][i] = gets.to_i }

r.times { |i|
  n = 0
  c.times { |j|
    n += m[i][j] * m[r][j]
  }
  puts n
}