module Main where

solve :: Integer -> Integer -> Integer
solve n k = (\x -> x `mod` (10 ^ 9 + 7))
	$ sum $ map (\i -> (sumConsec (n - i + 1) n) - (sumConsec 0 (i - 1)) + 1) [k .. n + 1]

sumConsec :: Integer -> Integer -> Integer
sumConsec x1 x2 = (x1 + x2) * (x2 - x1 + 1) `div` 2

main :: IO ()
main = interact $ show . (\x -> solve (read $ head x) (read $ last x)) . words

