//In the name of God:)
#include <bits/stdc++.h>
#define pb push_back
#define F first
#define S second
#define pii pair<int,int>
#define ll long long int
#define fast  ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const int MAXN = 2e5 + 10;
const int MOD = 1e9 + 7;

int main(){

    ll ans = 0 , n , k;
    scanf("%lld%lld" , &n , &k);
    for(ll i = k ; i <= n+1 ; i++){
        ans = (ans + 1 +((i * (2*n-i+1) / 2) - ((i-1) * i / 2 ))) % MOD;
        // cout<<i<<' '<<i * (2*n-i+1) / 2<<endl;
    }
    printf("%lld\n" , ans);
}
