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