main = do
  s <- getLine
  let [m,n] = map (read::String->Int) . words $ s

  s <- getContents
  let x = (map (map (read::String->Int) . words)  . lines) s
  let y = splitAt m x
  let a = fst y
  let b = (concat . snd) y
      
  mapM_ print $ mulMat a b

mulMat :: [[Int]] -> [Int] -> [Int]
mulMat a b = 
  map (sum . (zipWith (*) b)) a