{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
import qualified Data.ByteString.Char8 as BC
import           Data.Maybe            (fromJust)

main :: IO ()
main = do
  [n, k] <- getInts
  print $ solve n k

solve :: Int -> Int -> Int
solve n k = sum $ map (countOverMod n k) [1 .. n]

countOverMod :: Int -> Int -> Int -> Int
countOverMod n 0 _ = n
countOverMod n k b = s * p + t where
  (p, q) = divMod n b
  s = max (b - k) 0
  t = max (q - k + 1) 0

readInts :: BC.ByteString -> [Int]
readInts = map (fst . fromJust . BC.readInt) . BC.words

getInts :: IO [Int]
getInts = readInts <$> BC.getLine
