#include<stdio.h>

#include<string.h>

#include<math.h>
long long sum(long long x){
return x*(x+1)/2;}


int main(){

long long n,k;

scanf("%lld%lld",&n,&k);


long long a,b=n,c,d=0,maxsum=0,minsum=0,ans=0;
for(a=k;a<=n;a++){
 maxsum=sum(n)-sum(n-a);
 minsum=sum(a-1);
 ans+=maxsum-minsum+1;
 b=n;d=0;maxsum=0,minsum=0;
}

printf("%lld\n",(ans+1)%1000000007);



return 0;}