#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
    //変数定義, 入力処理
    // vector<vector<int>> data(3, vector<int>(4)); //二次元配列
    int N, K, cnt = 0;
    int mod = 1e9 + 7;
    cout << mod << endl;
    cin >> N >> K;
    //処理
    for (int i = K - 1; i <= N; i++) {
        cnt += ((double)(2 * N - i) / 2) * (i + 1) - ((double)i / 2) * (i + 1) + 1;
        cnt %= mod;


    }
    //出力処理
    cout << cnt << endl;
    return 0;
}
