#include<stdio.h>

int main(void)
{
  long long int n,k,sum1=0,sum2=0,sum3=0,i,j;
  
  scanf("%lld%lld",&n,&k);
  
  for(i=k;i<=n;i++){
    sum1 = 0;
    sum2 = 0;
    
    sum1 = i*(i-1)/2;
    
    sum2 = i*(2*n-i+1)/2;
    
    sum3+=(sum2-sum1+1);
  }
  
  printf("%lld", sum3%1000000007);
 
  return 0;
}
