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

N += 1

mod = 10**9+7



ans = 0

for i in range(N+1-K):

    nowk = K+i

    min_k = nowk*(nowk-1)//2

    max_k = (2*N-nowk-1)*nowk//2

    ans += (max_k-min_k+1)%mod

    ans %= mod

print(ans)
import sys

def input(): return sys.stdin.readline().strip()

def mapint(): return list(map(int, input().split()))

sys.setrecursionlimit(10**9)



N, K = mapint()

mod = 10**9+7

from itertools import accumulate

lis = list(accumulate([0]+[i for i in range(N+1)]))

ans = 0

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

    MIN = lis[k]

    MAX = lis[-1]-lis[-1-k]

    ans += (MAX-MIN+1)

    ans %= mod

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

import sys


def input():
    return sys.stdin.readline().strip()


def mapint():
    return list(map(int, input().split()))


sys.setrecursionlimit(10**9)
N, K = mapint()
mod = 10**9 + 7
from itertools import accumulate

lis = list(accumulate([0] + [i for i in range(N + 1)]))
ans = 0
for k in range(K, N + 2):
    MIN = lis[k]
    MAX = lis[-1] - lis[-1 - k]
    ans += MAX - MIN + 1
    ans %= mod
print(ans)

-N, K = list(map(int, input().split())) -N += 1 +import sys + + +def input(): +    return sys.stdin.readline().strip() + + +def mapint(): +    return list(map(int, input().split())) + + +sys.setrecursionlimit(10**9) +N, K = mapint() +from itertools import accumulate + +lis = list(accumulate([0] + [i for i in range(N + 1)])) -for i in range(N + 1 - K): -    nowk = K + i -    min_k = nowk * (nowk - 1) // 2 -    max_k = (2 * N - nowk - 1) * nowk // 2 -    ans += (max_k - min_k + 1) % mod +for k in range(K, N + 2): +    MIN = lis[k] +    MAX = lis[-1] - lis[-1 - k] +    ans += MAX - MIN + 1