#include <stdio.h>
#include <stdlib.h>

#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <stdint.h>
#include <string.h>

//#define _USE_MATH_DEFINES
//#include <math.h>

#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <deque>
#include <string>

#include <algorithm>
#include <functional>
#include <bitset>
#include <functional>
#include <chrono>
#include <random>
#define sqr(x) (x) * (x)

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
typedef long long int i64;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;
using namespace std::chrono;

const i64 mod = 1000000007ll;
//const i64 smod = 998244353ll;
const i64 inf = 1'000'000'000'000'000'000ll + 7;

const double eps = 1e-8;

const i64 MAXN = 2 * 100'000 + 6;
i64 n, k;

i64 c[MAXN];

i64 binpow(i64 a, i64 n) {
    i64 res = 1;
    while (n) {
        if (n & 1) {
            res *= a;
            res %= mod;
        }
        a *= a;
        a %= mod;
        n >>= 1;
    }
    return res % mod;
}


int main(int argc, char* argv[]) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(15); cout.setf(ios::fixed);

    cin >> n >> k;

    i64 z = binpow(10, 100);

    vector<pair<i64, i64>> q;

    i64 R = 0;
    for (i64 m = k; m <= n + 1; m++) {
        i64 sh = (z * m) % mod;

        i64 smin = (m - 1) * m / 2;
        i64 smax = (2 * n - m + 1) * m / 2;

        //if (smax - smin + 1 >= mod) {
        //    cout << mod << endl;
        //    return 0;
        //}

        //cerr << smin << " " << smax << endl;

        R += (smax - smin + 1) % mod;
        R %= mod;

        //if (smax >= smin) {
        //    q.push_back({ smin, 0 });
        //    q.push_back({ smax, 1 });
        //}
        //else {
        //    q.push_back({ smax, 0 });
        //    q.push_back({ mod - 1, 1 });

        //    q.push_back({ 0, 0 });
        //    q.push_back({ smin, 1 });
        //}
    }

    cout << R << endl;

    //sort(q.begin(), q.end());

    //vector<pair<i64, i64>> r;

    //i64 l = q[0].first;
    //i64 o = 1;
    //for (i64 i = 1; i < q.size(); i++) {
    //    if (!q[i].second) {
    //        if (!o) {
    //            l = q[i].first;
    //        }
    //        o += 1;
    //    }
    //    else {
    //        o -= 1;
    //        r.push_back({ l, q[i].first });
    //    }
    //}

    //i64 R = 0;
    //for (auto t : r) {
    //    R += t.second - t.first + 1;
    //    R %= mod;
    //}

    //cout << R << endl;

    return 0;
}