import sys

input = sys.stdin.readline

from collections import *

from math import *



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

MOD = 10**9+7

ans = 0



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

    c = ((2*N-i+1)*i)//2-i*(i-1)//2+1

    ans += c

    ans %= MOD



print(ans)
def f(s, e):

    return (e-s+1)*(s+e)//2



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

ans = 0

MOD = 10**9+7



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

    ans += f(N-i+1, N)-f(0, i-1)+1

    ans %= MOD



print(ans)
import sys

input = sys.stdin.readline
from collections import *
from math import *

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

def f(s, e):
    return (e - s + 1) * (s + e) // 2


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

-import sys +def f(s, e): +    return (e - s + 1) * (s + e) // 2 -input = sys.stdin.readline -from collections import * -from math import * +ans = 0 -ans = 0 -    c = ((2 * N - i + 1) * i) // 2 - i * (i - 1) // 2 + 1 -    ans += c +    ans += f(N - i + 1, N) - f(0, i - 1) + 1