#include<iostream>
using namespace std;

int main(){
    long long n, k;
    cin >> n >> k;
    long long sum = 0;
    for(long long i = k; i <= n+1; i++){
        long long min = i * (i-1) / 2;
        long long max = n * i - min;
        sum += max - min + 1;
    }
    sum %= 1000000007;
    cout << sum << endl;
    return 0;
}