import qualified Data.ByteString.Char8 as B
import           Data.List

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

readInts :: IO [Int]
readInts = map (maybe (error "parse error") fst . B.readInt) . B.words <$> B.getLine

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