#include <stdio.h>
#define MIN(x,y) (((x) > (y)) ? (y) : (x))
#define ABS(x) ((x) >= 0 ? (x) : (-(x)))

long long sum_f[200010];
int P = 1000000007;
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= n + 1; i++) {
    sum_f[i] = sum_f[i - 1] + i;
  }
  long long sum = 0;
  for (int i = k; i <= n + 1; i++) {
    sum = (sum + ((sum_f[n + 1] - sum_f[n + 1 - i]) - sum_f[i] + 1)) % P;
  }
  printf("%lld", sum);
  return 0;
}