#include <iostream>
#include <stdio.h>
#include <stdlib.h> //rand() 0~RAND_MAX2147483647
#include <math.h>
#include <time.h>   //srand((unsigned int)time(NULL));
#include <unistd.h> //sleep
#include <algorithm>
#include <cmath>
#include <vector>
#include <regex> //正規表現
#include <map>
#include <unordered_map>
#include <set>
#include <cassert> //assart
#include <numeric>
#include <iterator>
#include <list>
#include <tuple>
#include <queue>

using namespace std;
#define ll long long int
#define FOR(i,min,max) for(ll i=(min);i<(max);i++)
#define FOReq(i,min,max) for(ll i=(min);i<=(max);i++)
#define FORREV(i,max,min) for(ll i=(max)-1;i>=(min);i--)
#define FORREVeq(i,max,min) for(ll i=(max);i>=(min);i--)
const int MOD=1e9+7;
const int MOD2=998244353;
const int not0=1;
const int INF=2000000001;
const ll INFll=2e18;
//const int MAX_V=10000;
const double  Micro=1e-5;

int UnUsedVariable(){
    if(INF || Micro || MOD || INFll || MOD2 || not0){;}
    return 0;
}

#define inarray(array,min,max) FOR(i,min,max){cin>>array[i];}
#define inarrayW(arrayA,arrayB,min,max) FOR(i,min,max){cin>>arrayA[i]>>arrayB[i];}
#define br printf("\n");
#define OutputAndReturn0(x) {cout<<(x)<<endl;return 0;}
#define elif else if

#define issame(a,b,c,d) ((a)==(b) and (b)==(c) and (c)==(d))
#define isdiff3(a,b,c) ((a)!=(b) and (b)!=(c) and (c)!=(a))
#define isdiff4(a,b,c,d) ((a)!=(b) and (b)!=(c) and (c)!=(a) and (d)!=(a) and (d)!=(b) and (d)!=(c))
#define isdiff5(a,b,c,d,e) ((a)!=(b) and (b)!=(c) and (c)!=(a) and (d)!=(a) and (d)!=(b) and (d)!=(c) and (e)!=(a) and (e)!=(b) and (e)!=(c) and (e)!=(d))
#define Func3(f,a,b,c) (f)((f)((a),(b)),(c))
#define Func4(f,a,b,c,d) (f)((f)((f)((a),(b)),(c)),(d))

inline int isEven(int x){return x%2==0;}
inline int isOdd (int x){return x%2==1;}
inline ll  gcd(ll a,ll b){ if(b==0)return a;else return gcd(b,a%b);}//最大公約数 なお一方が0なら答えは他方になるので番兵は０で良い また、負の数もOK -4%3=-1となるため
inline ll  lcm(ll a,ll b){return a*b/gcd(a,b);}//MODやオーバーフローには注意！
//inline ll  ceil(double a){return (ll)a+1;}
//ans = accumulate(A, A+N, 0, [](int a, int b) {return gcd(a,b);});
//auto count = std::count_if(v.begin(), v.end(), [](int x) { return x == 1 || x == 3; } );




//Eと名のつくのはデバッグ用！
int EintN(ll array[],const ll num){
    for(int i=0;i<num;i++){cerr<<array[i]<<" ";}
    br;
    return 0;
}
//int EintNN(const int heighth,const int width,int array[heighth][width]){
//    FOR(i, 0, heighth){
//        FOR(k, 0, width){
//            {cerr<<array[i][k]<<" ";}
//        }
//        br;
//    }
//    br;
//    return 0;
//}
int Eint(string str,const ll num){
    cerr<<str<<" is "<<num<<" now."<<endl;
    return 0;
}







bool IsPrime(ll num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く
    
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }
    
    // 素数である
    return true;
}



ll combinum[10010][10010]={};
ll combi(ll n, ll k) {
    if (n == k || k == 0 )
        return 1;
    else if (combinum[n][k]!=0){
        return combinum[n][k];
    }else {
        return combinum[n][k]=combi(n - 1, k - 1) + combi(n - 1, k);
    }
}

long long IntPow(long long x, long long n){
    assert(n>=0);
    if(n == 0)
        return 1;
    if(n % 2 == 0)
        return IntPow(x * x, n / 2);
    else
        return x * IntPow(x, n - 1);
}

ll probA(){
    ll ans;ans=0;
    ll A;
    cin>>A;
    OutputAndReturn0(2*A*3.141592)
    return 0;
}

ll probB(){
    ll ans;ans=0;
    ll N,M;
    cin>>N>>M;
    ll Day[M];
    
    

    ll sum=0;
    inarray(Day, 0, M);
    FOR(i, 0, M){
        sum+=Day[i];
    }
    
    return 0;
}

ll probC(){
    ll ans;ans=0;
    ll K;
    cin>>K;
    ll A[K];
    FOR(i, 0, K){
        A[i]=0;
    }
    
    
    ll temp;
    FOR(i, 1, K){
        cin>>temp;
        A[temp]++;
    }
    
    FOR(i, 1, K){
        cout<<A[i]<<endl;
    }
    cout<<0<<endl;
    
    return 0;
}

ll allsum(ll a){
    return a*(a+1)/2;
}

ll probD(){
    ll ans;ans=0;
    ll N, K;
    cin>>N>>K;
    
    FOReq(i, K, N+1){
        ans+=(  allsum(N+1)-allsum(N+1-i)-allsum(i)+1  );
        ans = ans%MOD;
    }
    
    OutputAndReturn0(ans);
    return 0;
}

ll probE(){
    ll ans;ans=0;
    ll N;cin>>N;
    
    ll eachnumMaisuu[N+1];
    fill(eachnumMaisuu, eachnumMaisuu+N+1, 0);
    FOR(i, 0, N){
        ll temp=0;
        cin>>temp;
        eachnumMaisuu[temp]++;
    }
    //どの数字が何枚あるかを調査
    
    EintN(eachnumMaisuu, N);
    
    sort(eachnumMaisuu, eachnumMaisuu+N+1);
    EintN(eachnumMaisuu, N);
    //各数字は区別されないのでソート
    
    ll kindofXmai[N+1];
    fill(kindofXmai, kindofXmai+N+1, 0);
    FOR(i, 1, N+1){
        kindofXmai[eachnumMaisuu[i]]++;
    }
    //１枚しかない数字が何種類あるか、にした
    
    EintN(kindofXmai, N+1);
    
    OutputAndReturn0(ans);
    return 0;
}

ll probF(){
    ll ans;ans=0;
    ll N;
    cin>>N;
    ll A[N]; // 0-index 0 to N-1
    inarray(A, 0, N);
    
    ll sum0246[N];
    ll sum1357[N];
    ll sumN1N3[N];
    ll sumN2N4[N];
    
    FOR(i,0,N){
        sum0246[i]=0;
        sum1357[i]=0;
        sumN1N3[i]=0;
        sumN2N4[i]=0;
    }
    
    sum0246[0]=A[0]; // N/2 +1
    sum1357[0]=A[1]; // N/2
    sumN1N3[0]=A[N-1];//first-end even N/2 +1
    sumN2N4[0]=A[N-2];//mid       odd  N/2
    
    FOR(i, 2, N){
        if(i%2==0){sum0246[i/2]=sum0246[(i/2)-1]+A[i];}
        if(i%2==1){sum1357[i/2]=sum1357[(i/2)-1]+A[i];}
    }
    
    
    
    
    if(N%2==0){
        ans=max(sum0246[(N/2)-1], sum1357[(N/2)-1]);
        OutputAndReturn0(ans);
    }
    else{ //N%2==1
        FOR(i, 2, N){//N is assumed at odd
            if((N-1-i)%2==0){sumN1N3[i/2]=sumN1N3[(i/2)-1]+A[N-1-i];}
            if((N-1-i)%2==1){sumN2N4[i/2]=sumN2N4[(i/2)-1]+A[N-1-i];}
        }
        ans=max(sum0246[N/2]-sum0246[0], sum0246[(N/2)-1]);
        ans=max(ans, sum1357[(N/2)-1]);
        EintN(sum0246, N);
        EintN(sum1357, N);
        EintN(sumN1N3, N);
        EintN(sumN2N4, N);
        FOR(i, 1, N/2){ //iこ　とN/2-iこ　を足す
            ans=max(ans,sum0246[i-1]+sumN2N4[(N/2)-i-1]);
            ans=max(ans,sum1357[i-1]+sumN1N3[(N/2)-i-1]);
            ans=max(ans,sum0246[(N/2)]-A[2*i]);
        }
        
    }
    OutputAndReturn0(ans);
    return 0;
}

signed main(){
    cin.tie(0);    //cinとcoutの結び付き解除（cout時にcinの内容を吐き出さなくなる）
    ios::sync_with_stdio(false);  //coutとprintfの結び付き解除（coutとprintfを同時に使うな！）
    probD();
    return 0;
}


Measured memory_bytes: 3196