import           Control.Applicative
import           Control.Monad

main :: IO ()
main = do
    [n, m] <- fmap read . words <$> getLine :: IO [Int]
    as <- replicateM n getLine
    bs <- replicateM m getLine
    let cs = fmap (fmap read . words) as :: [[Int]]
    let ds = fmap read bs :: [Int]
    forM_ cs $ \c -> do
        print $ sum $ zipWith (*) c ds

