import Control.Applicative
import Control.Monad

main :: IO ()
main = do
    [n,m] <- map read . words <$> getLine
    mat <- replicateM n $ map read . words <$> getLine
    vec <- replicateM m readLn
    mapM_ (print . prod vec) mat

prod :: [Int] -> [Int] -> Int
prod u v = sum $ zipWith (*) u v
