main = do
  (_:sM:sC:_) <- words <$> getLine
  let m = (read sM) :: Int
  let c = (read sC) :: Integer
  let cs = take m $ repeat c
  bs <- map (read :: String-> Integer) <$> words <$> getLine
  aMat <- map (map read :: [String]-> [Integer]) <$> map words <$> lines <$> getContents
  let matMuled = map (\ aLine -> zipWith (*) aLine bs) aMat
  let aSum = foldl (\ aSumTmp aLine -> zipWith (+) aSumTmp aLine) cs matMuled
  putStrLn $ show  $ length $ filter (\a -> a > 0) aSum
