#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <cassert>
#include <fstream>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

const ll mod = 1e9 + 7;

vector<string> g;

int main() {

    ifstream in("input.txt");
    cin.rdbuf(in.rdbuf());
    
    ll n, k;
    cin >> n >> k;
    
    ll ret = 0;
    for (ll i = k; i <= n + 1; ++i)
    {
        ll min = ((i - 1) * i) / 2ll;
        ll max = ((2ll * n + 1 - i) * i) / 2ll;
        ret += (max - min + 1ll) % mod;
        ret %= mod;
    }
    
    
    cout << ret << endl;

    
    return 0;
}