-- https://github.com/minoki/my-atcoder-solutions
import Data.Char (isSpace)
import Data.Int (Int64)
import Data.List (unfoldr)
import qualified Data.ByteString.Char8 as BS

main = do
  [n,k] <- map fromIntegral . unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
  print (sum [ m * n - m * (m - 1) + 1 | m <- [k..n+1] ] `mod` (10^9+7) :: Int64)
