import Control.Monad
import Data.List


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