main = do
  (n:m:_) <- getInts
  as <- getInts
  let sums = concat [tail $ scanl (+) 0 $ drop i as | i <- [0..n-1]]
  print $ length $ filter (\x -> x `mod` m == 0) $ sums
 where getInts = map read.words <$> getLine
