#include <stdio.h>

int main(void){

  long n,k;
  scanf("%ld %ld", &n, &k);
  long sum = 0;
  for (long i = k; i <= n+1; i++) {
    sum += n*i-(i*(i-1)/2)+1;
    sum -= (i*(i-1)/2);
    sum %= 1000000007;
  }
  printf("%ld\n", sum);

  return 0;
}