import Control.Applicative
import Control.Monad
import Data.List
main = do
  [n,m]<- map (read::String->Int).words <$> getLine
  rows <-  map (map (read::String->Int) .words) <$> (replicateM n getLine)
  b <- map (read::String->Int) <$> (replicateM m getLine)
  putStr $ unlines $ map (\r-> show $ sum (zipWith (*) r b)) rows