import Control.Applicative
import Control.Monad

main = do
    [n, m] <- map (read :: String -> Int) . words <$> getLine
    tmpa   <- map words <$> (replicateM n getLine)
    let a   = map (map read) tmpa :: [[Int]]
    b      <- map (read :: String -> Int) . lines <$> getContents
    mapM_ print $ map sum $ map (zipWith (*) b) a
