#include <bits/stdc++.h>
using namespace std;
#define int long long
#define in ({int x=0;int c=getchar(),n=0;for(;!isdigit(c);c=getchar()) n=(c=='-');for(;isdigit(c);c=getchar()) x=x*10+c-'0';n?-x:x;})
#define forinc(i,a,b) for(int i=a;i<=b;i++)
#define fordec(i,a,b) for(int i=a;i>=b;i--)
#define pii pair<int,int>
#define fi first
#define se second

const int mod=1e9+7;
int n,k,ret;
int get(int u,int v){
    int z=v-u+1;
    return (u+v)*z/2;
}
int sum(int A) { return get(0,A-1);}
int sum1(int A) {return get(n-A+1,n);}
main()
{
    cin>>n>>k;
    forinc(i,k,n+1){
        int A=sum(i),B=sum1(i);
        //cout<<A<<" "<<B<<"\n";
        ret=(ret+(B-A+1+mod)%mod)%mod;
    }
    cout<<ret;
}
