main = do
    line1 <- getLine
    let (n,m) = (nums!!0, nums!!1)
                   where nums = map (\x -> read x :: Int) $ words line1
    ss <- getContents
    let ls = lines ss
    let as = map (map (\x -> read x :: Int)) $ map words $ take n ls
    let ms = map (\x -> read x :: Int) $ drop n ls
    let ans = map (calcC ms) as
    mapM_ putStrLn $ map show ans

calcC ms am = sum $ map (\(x,y) -> x*y) $ zip ms am
