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