main = do
  (n:m:_) <- getInts
  as <- getInts
  let sigma = scanl (+) 0 as
      sums = [(sigma !! j) - (sigma !! i) | i <- [0..n], j <- [0..n], i < j]
  print $ length $ filter (\x -> x `mod` m == 0) $ sums
 where getInts = map read.words <$> getLine :: IO [Int]