local ffi=require"ffi"
local modint
do
local MOD=1000000007
local mt={}
modint=setmetatable({new=function(x)return setmetatable({v=x},mt)end},{__call=function(o,x)return setmetatable({v=x%MOD},mt)end})
local function add(a,b)return (a+b)%MOD end
function mt.__add(a,b) return modint.new(add(a.v,b.v))end
local function sub(a,b)return (a-b)%MOD end
function mt.__sub(a,b) return modint.new(sub(a.v,b.v))end
local function mul(a,b)
	local ret=0
	while(b>0)do
		if(b%2==1)then ret=(ret+a)%MOD end
		a=(a+a)%MOD
		b=math.floor(b*.5)
	end
	return ret
end
function mt.__mul(a,b)
	a=a.v b=b.v
	return modint(a<b and mul(b,a)or mul(a,b))
end
local function pow(a,b)
	local ret=1
	while(b>0)do
		if(b%2==1)then ret=mul(ret,a)end
		a=mul(a,a)
		b=math.floor(b*.5)
	end
	return ret
end
function mt.__pow(a,b)return modint(pow(a.v,b.v))end
local function inv(x)
local a=x
local b,u,v=MOD,1,0
repeat
local t=math.floor(a/b)
a,b=b,a-t*b
u,v=v,u-t*v
until(b==0)
return u
end
local function div(a,b)return mul(a,inv(b))end
function mt.__div(a,b)return modint.new(div(a.v,b.v))end
function mt.__tostring(x)return tostring(x.v)end
local method={}
mt.__index=method
function method.inv(x)return modint.new(inv(x.v))end
do
local MAX=510000
local ct=ffi.typeof("int[$]",MAX)
local fac=ffi.new(ct,{1,1})
local inv=ffi.new(ct,{1,1})
local finv=ffi.new(ct,{1,1})
for i=2,MAX-1 do
fac[i]=mul(fac[i-1],i)
inv[i]=MOD-mul(inv[MOD%i],math.floor(MOD/i))
finv[i]=mul(finv[i-1],inv[i])
end
function method.C(n,k)
n=n.v k=k.v
if(n<k)then return 0 end
return mul(mul(finv[k],finv[n-k]),fac[n])
end
end
end --modint define

N=io.read"*n"
K=io.read"*n"

r=modint(0)
for i=K,N+1 do
local min=i*(i-1)/2
local max=(N-i+1+N)*i/2
r=r+modint(max-min+1)
end
print(r)




