n, m = gets.split.map(&:to_i)
a_ary = Array.new(n){Array.new(m, 0)}
b_ary = Array.new(m, 0)
n.times do |n|
    a_ary[n] = gets.split.map(&:to_i)
end
b_ary = readlines.map(&:chomp).map(&:to_i)
n.times do |n|
    total = 0
    m.times do |m|
        a = a_ary[n][m]
        b = b_ary[m]
        total = total + a*b
    end
    puts total
end
