#include <stdio.h>
 
int main(void){
  long long int i;
  long long int n, k, sum=0, max=0, min=0;
  
  scanf("%lld %lld", &n, &k);
  
  for(i = k; i <= n+1; i++){
      min = i*(i-1)/2;
      max = i*(2*n-i+1)/2;
    sum += max-min+1;
  }
  printf("%lld", sum%1000000007);
  
  return 0;
}