local mfl, mce = math.floor, math.ceil
local mod = 1000000007
local n, k = io.read("*n", "*n")
local ret = 0
for i = k, n + 1 do
  local smallest = mfl(i * (i - 1) / 2)
  local largest = mfl((n + n - i + 1 ) * i / 2)
  -- print(smallest, largest)
  ret = (ret + largest - smallest + 1) % mod
end
print(ret)
