n,m=gets.split(' ')
n=n.to_i
m=m.to_i
mp1=Array.new(n)
mp2=Array.new(m)
for i in 1..n do
    mp1[i-1]=gets.split(' ').map(&:to_i)
end
for j in 1..m do
    mp2[j-1]=gets.to_i
end

for x in 1..n do
    p=0
    r=0
    mp1[x-1].each do |i|
       r=r+i*mp2[p]
       p+=1
    end
    printf("%d\n",r)
end