main :: IO ()
main = do
    [n, k] <- map read . words <$> getLine
    print $ solve n k

solve :: Int -> Int -> Int
solve n k
    | odd k
    = length [k, k * 2 .. n] ^ 3
    | even k
    = length [(k `div` 2), (k `div` 2 + k) .. n]
        ^ 3
        + length [k, 2 * k .. n]
        ^ 3