from math import factorial
N, K = map(int, input().split())

ans = 0
for i in range(K, N + 2):
    # print(i)

    tmp_min = (i - 1) * i / 2
    tmp_max = (N * (N + 1) / 2) - ((N - i) * (N - i + 1) / 2)
    # print(tmp_min, tmp_max)

    tmp = tmp_max - tmp_min + 1
    ans += tmp

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