import Data.Maybe
import Control.Monad
import qualified Data.ByteString.Char8 as C

readInt' = fst.fromJust.C.readInteger
readLnInt = map readInt'.C.words<$>C.getLine
readCsInt n = concat<$>replicateM n readLnInt

x ? (a,b) = if x then a else b
a~>(f,x) = [a] ++ (null x)?([],f x)
half = flip div 2
aliq = ((0==).).mod

main = do
 inputs <- readLnInt
 print $ solve inputs

solve [n,k]
 | n<k = 1
 | otherwise = mod (f n k 0) 1000000007

f n t x
 | t > n+1 = x
 | otherwise = f n (t+1) x' where
    x' = x + calc n t

calc n t = t*(n-t+1)
