#include <iostream>
#include <cstdlib>
#include <utility>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <numeric>

using namespace std;
const int MOD = 1000000007;
const int MOD_MAX = 200000;

using ll = long long;
using vi = vector<int>; using vi2 = vector<vi>; using vi3 = vector<vi2>;
using vll = vector<ll>; using vll2 = vector<vll>; using vll3 = vector<vll2>;
using pi = pair<int, int>; using pll = pair<ll, ll>;
using vpi = vector<pi>; using vpll = vector<pll>;

#define loopi(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define loop(i, n) for (int i = 0; i < (int)n; i++)
#define loopeq(i, n) for (int i = 0; i <= (int)n; i++)
#define loopll(i, n) for (ll i = 0; i < (ll)n; i++)
#define looplleq(i, n) for (ll i = 0; i <= (ll)n; i++)
#define rloopi(i, a, b) for(int i = (int)a - 1; i >= (int)b; i--)
#define rloop(i, n) for (int i = (int)n - 1; i >= 0; i--)
#define rloopeq(i, n) for (int i = (int)n - 1; i >= 1; i--)
#define rloopll(i, n) for (int i = (ll)n - 1; i >= 0; i--)
#define rlooplleq(i, n) for (int i = (ll)n - 1; i >= 1; i--)
#define all(a) (a).begin(), (a).end()

ll fact_arr[MOD_MAX], finv_arr[MOD_MAX], inv_arr[MOD_MAX];
void comb_init() {
	fact_arr[0] = fact_arr[1] = 1;
    finv_arr[0] = finv_arr[1] = 1;
    inv_arr[1] = 1;
    for (int i = 2; i < MOD_MAX; i++){
        fact_arr[i] = fact_arr[i - 1] * i % MOD;
        inv_arr[i] = MOD - inv_arr[MOD % i] * (MOD / i) % MOD;
        finv_arr[i] = finv_arr[i - 1] * inv_arr[i] % MOD;
    }
}
class mint {
public:
	ll value;
	
	mint(ll a = 0) : value((a % MOD + MOD) % MOD) {}
	bool operator < (mint a) { return this->value < a.value; }
	bool operator > (mint a) { return this->value > a.value; }
	bool operator <= (mint a) { return this->value <= a.value; }
	bool operator >= (mint a) { return this->value >= a.value; }
	mint& operator += (const mint& a) { if ((this->value += a.value) > MOD) this->value -= MOD; return *this; }
	mint& operator -= (const mint& a) { if ((this->value -= a.value) < 0ll) this->value += MOD; return *this; }
	mint& operator *= (const mint& a) { (this->value *= a.value) %= MOD; return *this; }
	mint operator + (const mint a) const { mint ret(this->value); return ret += a; }
	mint operator - (const mint a) const { mint ret(this->value); return ret -= a; }
	mint operator * (const mint a) const { mint ret(this->value); return ret *= a; }
	mint pow(ll times) const {
		if (!times) return 1;
		mint ret = pow(times >> 1);
		ret *= ret;
		if (times & 1) ret *= *this;
		return ret;
	}
	mint inv() const { return pow(MOD - 2); }
	mint& operator /= (const mint& a) { return (*this) *= a.inv(); }
	mint operator / (const mint a) const { mint ret(this->value); return ret /= a; }
	friend ostream& operator << (ostream& os, const mint& m) { os << m.value; return os; }
};

mint comb(mint n, mint r) { 
	if ( n < r || n < 0 || r < 0) return 0;
	return mint(fact_arr[n.value]) * mint(finv_arr[r.value]) * mint(finv_arr[(n - r).value]);
}
mint hcomb(mint n, mint r) { return comb(n + r - 1, r); }

mint comb_slow(mint n, mint r) {
	if (n < r || n.value < 0 || r.value < 0) return mint(0ll); 
	mint ret = 1ll; 
	if (r > n / 2) r = n - r;
	for (int i = 0; i < r.value; i++) ret = ret * (n - i); 
	for (int i = 0; i < r.value; i++) ret = ret / (i + 1); 
	return ret;
}
mint hcomb_slow(mint n, mint r) { return comb_slow(n + r - 1, r); }

int main() {
    mint n; cin >> n.value;
    mint k; cin >> k.value;
	mint sum = 0;
	for (ll i = k.value; i <= n.value + 1; i++) {
		mint min_value = (mint(0) + mint(i - 1)) * i / 2;
		mint max_value = (mint(n - i + 1) + mint(n)) * i / 2;
		sum += max_value - min_value + 1;
	}
	cout << sum << endl;
}

Measured memory_bytes: 3648