import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T

main :: IO ()
main = do
  (n : k : _) <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  let
    count :: Int -> Int
    count l = l * (n - l + 1) + 1
    c :: Int
    c = foldl step 0 . map count $ [k..(succ n)]
      where
        step x y = (x + y) `mod` modulus
  print c

modulus :: Int
modulus = 1000000007

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n
