import           Data.List

main :: IO ()
main = do
    [_, m] <- readInts
    as <- readInts
    print $ solve m as

readInts :: IO [Int]
readInts = map read . words <$> getLine

solve :: Int -> [Int] -> Int
solve m = sum . map (length . filter (`divisible` m) . scanl1 (+)) . tails
    where x `divisible` y = x `mod` y == 0
