#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define M (998244353)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll>Q;

ll suml[200010];
ll sumr[200010];

int main(void){
    ll n,k;
    cin>>n>>k;
    ll ans = 0;
    for(ll i=0;i<=n;i++){
        suml[i+1]=suml[i]+i;
    }
    for(ll i=0;i<=n;i++){
        sumr[i+1]=sumr[i]+n-i;
    }
    for(ll i=k;i<=n+1;i++){
        ll mi = suml[i];
        ll ma = sumr[i];
        ll tmp = (ma-mi+1)%N;
        ans = (ans+tmp+N)%N;
        ans = (ans+N)%N;
    }
    cout<<ans<<endl;
    return 0;
}