#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <queue>
#include <utility>
#include <map>
#include <bitset>
#include <numeric>
#define ll long long
using namespace std;
using p = pair<ll, ll>;
ll dx[8]={ 0, 1, 0,-1, 1, 1,-1,-1}; // x軸方向への変位
ll dy[8]={ 1, 0,-1, 0, 1,-1, 1,-1}; // y軸方向への変位
ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

ll fun(ll a){
    ll ans = 1;
    ll mod = 1000000007;
    for(ll i = 1; i <= a; i++)
        ans = ans * i % mod;
    return ans;
}
ll comb(ll n, ll r){
    ll child = 1, mother = 1;
    ll mod = 1000000007;
    for(ll i = 1; i <= r; i++){
        child = child * (n-i+1) % mod;
        mother = mother * i % mod;
    }
    //mother = modpow(mother, mod-2, mod);
    ll ans = child / mother;
    return ans;
}

int main(void){
    ll n, k;
    cin >> n >> k;
    ll INF = 1e+9+7;
    ll ans = 0;
    ll sum[n+1];
    for(ll i = 0; i <= n; i++){
        if(i==0) sum[i] = 0;
        else sum[i] = sum[i-1]+i;
    }
    for(ll i = k; i <= n; i++){
        ll a = sum[n]-sum[n-i];
        ll b = sum[i-1];
        ll c = a-b+1;
       // cout << a << " " << b << " " << ans << endl;
        ans = (ans + c)%INF;
    }
    ans = (ans+1)%INF;
    cout << ans << endl;
    return 0;
}
