import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.Array.Unboxed
import Data.Bits
import Data.List
import qualified  Data.ByteString as B
import Data.Ord


bsToInt :: BS.ByteString -> Int
bsToInt = fst . fromJust . BS.readInt

bsToIntList :: BS.ByteString -> [Int]
bsToIntList = map bsToInt . BS.words


main :: IO ()
main = do 
    n:k:_ <- bsToIntList <$> BS.getLine
    let t1 = [i*(n+1-i)+1 | i<-[k..n+1]]
    print $ (sum t1 `mod` (10^9 + 7))
