def resolve():
    m = 10**9 + 7
    ans = 0
    n, k = map(int, input().split())
    for i in range(k, n+2):
        low = i*(i-1)//2
        high = i*(2*n - i + 1)//2
        ans += (high - low + 1)
    ans %= m
    print(ans)
resolve()