N, K = list(map(int, input().split()))

MOD = 10 ** 9 + 7



LOW, HIGH = 0, N

ans = 0



if 1 >= K:

    ans += (HIGH - LOW + 1)



for i in range(2, N + 2):

    LOW += i - 1

    HIGH += N - i + 1

    LOW %= MOD

    HIGH %= MOD

    if i >= K:

        ans += (HIGH - LOW + 1)

        ans %= MOD



print(ans)

N, K = list(map(int, input().split()))

MOD = 10 ** 9 + 7



low, high = 0, 0

ans = 0

for i in range(1, N + 2):

    low += i - 1

    high += N - i + 1



    if i >= K:

        ans += (high - low + 1)

        ans %= MOD



print(ans)

N, K = list(map(int, input().split()))
MOD = 10**9 + 7
LOW, HIGH = 0, N
ans = 0
if 1 >= K:
    ans += HIGH - LOW + 1
for i in range(2, N + 2):
    LOW += i - 1
    HIGH += N - i + 1
    LOW %= MOD
    HIGH %= MOD
    if i >= K:
        ans += HIGH - LOW + 1
        ans %= MOD
print(ans)

N, K = list(map(int, input().split()))
MOD = 10**9 + 7
low, high = 0, 0
ans = 0
for i in range(1, N + 2):
    low += i - 1
    high += N - i + 1
    if i >= K:
        ans += high - low + 1
        ans %= MOD
print(ans)

-LOW, HIGH = 0, N +low, high = 0, 0 -if 1 >= K: -    ans += HIGH - LOW + 1 -for i in range(2, N + 2): -    LOW += i - 1 -    HIGH += N - i + 1 -    LOW %= MOD -    HIGH %= MOD +for i in range(1, N + 2): +    low += i - 1 +    high += N - i + 1 -        ans += HIGH - LOW + 1 +        ans += high - low + 1