def d_sum_of_large_numbers(MOD=10**9 + 7):

    N, K = [int(i) for i in input().split()]



    ans = 0

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

        tmp = 1 - k * (k - 1)

        ans += k * N + tmp

        ans %= MOD

    return ans



print((d_sum_of_large_numbers()))
def d_sum_of_large_numbers(MOD=10**9 + 7):

    N, K = [int(i) for i in input().split()]

    return (N + 2 - K) * (N**2 + (K + 1) * N - 2 * K**2 + 2 * K + 6) // 6 % MOD



print((d_sum_of_large_numbers()))
def d_sum_of_large_numbers(MOD=10**9 + 7):
    N, K = [int(i) for i in input().split()]
    ans = 0
    for k in range(K, N + 2):
        tmp = 1 - k * (k - 1)
        ans += k * N + tmp
        ans %= MOD
    return ans


print((d_sum_of_large_numbers()))

def d_sum_of_large_numbers(MOD=10**9 + 7):
    N, K = [int(i) for i in input().split()]
    return (N + 2 - K) * (N**2 + (K + 1) * N - 2 * K**2 + 2 * K + 6) // 6 % MOD


print((d_sum_of_large_numbers()))

-    ans = 0 -    for k in range(K, N + 2): -        tmp = 1 - k * (k - 1) -        ans += k * N + tmp -        ans %= MOD -    return ans +    return (N + 2 - K) * (N**2 + (K + 1) * N - 2 * K**2 + 2 * K + 6) // 6 % MOD