module Main where

import Data.Functor

main :: IO ()
main =  do
 { [n,m] <- getInts
 ; mat <- loop1 n
 ; vec <- loop2 m
 ; putStr $ unlines $ map show [sum $ zipWith (*) l vec | l <- mat]
 }

loop1 :: Int -> IO [[Int]]
loop1 0 = return []
loop1 n = do
  { l <- getInts
  ; ls <- loop1 (n-1)
  ; return (l:ls)
  }

loop2 :: Int -> IO [Int]
loop2 0 = return []
loop2 n = do
  [v] <- getInts
  vs  <- loop2 (n-1)
  return (v:vs)

getInts :: IO [Int]
getInts = map read . words <$> getLine