import Control.Monad
import Data.List


main = do
    [n, m] <- fmap (map read . words) $ getLine
    a <- fmap (map (map read . words)) $ replicateM n getLine
    b <- fmap (map read) $ replicateM m getLine
    mapM_ print $ map (foldr1 (+) . map (uncurry (*)) . zip b) a