  iN,iM=$stdin.gets.split.map(&:to_i)
  iA=[]
  iN.times do
    iA<<$stdin.gets.split.map(&:to_i)
  end
  iB=[]
  iM.times do
    iB<<$stdin.gets.to_i
  end
  iN.times do |i|
    ans=[]
    iB.each_with_index do |n,j|
      ans << iA[i][j]*n
    end
    puts ans.sum
  end
