

n, k = list(map(int, input().split()))

ans = 0

mod = 10**9+7



for i in range(k, n+2):

    ans += int(n*(n+1)/2 - (n-i)*(n-i+1)/2 - (i-1)*i/2 + 1)

print((ans % mod))



'''

n, k = map(int, input().split())

ans = 0

for i in range(k, n+2):

    a = 0.5*i*(i-1)

    b = 0.5*n*(n+1)-0.5*(n-i)*(n-i+1)

    ans += int(b-a+1)



print(ans % (10**9+7))

'''

n, k = list(map(int, input().split()))

ans = 0

for i in range(k, n+2):

    ma = (n+n-i+1)*i//2

    mi = (i-1)*i//2

    # print(ma, mi)

    add = ma-mi+1

    ans += add



print((int(ans % (10**9+7))))

n, k = list(map(int, input().split()))
ans = 0
mod = 10**9 + 7
for i in range(k, n + 2):
    ans += int(n * (n + 1) / 2 - (n - i) * (n - i + 1) / 2 - (i - 1) * i / 2 + 1)
print((ans % mod))
"""
n, k = map(int, input().split())
ans = 0
for i in range(k, n+2):
    a = 0.5*i*(i-1)
    b = 0.5*n*(n+1)-0.5*(n-i)*(n-i+1)
    ans += int(b-a+1)
print(ans % (10**9+7))
"""

n, k = list(map(int, input().split()))
ans = 0
for i in range(k, n + 2):
    ma = (n + n - i + 1) * i // 2
    mi = (i - 1) * i // 2
    # print(ma, mi)
    add = ma - mi + 1
    ans += add
print((int(ans % (10**9 + 7))))

-mod = 10**9 + 7 -    ans += int(n * (n + 1) / 2 - (n - i) * (n - i + 1) / 2 - (i - 1) * i / 2 + 1) -print((ans % mod)) -""" -n, k = map(int, input().split()) -ans = 0 -for i in range(k, n+2): -    a = 0.5*i*(i-1) -    b = 0.5*n*(n+1)-0.5*(n-i)*(n-i+1) -    ans += int(b-a+1) -print(ans % (10**9+7)) -""" +    ma = (n + n - i + 1) * i // 2 +    mi = (i - 1) * i // 2 +    # print(ma, mi) +    add = ma - mi + 1 +    ans += add +print((int(ans % (10**9 + 7))))