def sum_start(k):
    return (k-1) * k / 2

def sum_end(n,k):
    return sum_start(n+1) - sum_start(n-k+1)


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

total = 0
while((N + 1) >= K):
    start = sum_start(K)
    end = sum_end(N,K)
    total += end - start + 1
    K += 1

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