#include <stdio.h>
typedef long long int lld;
typedef unsigned long long int llu;
#define MAX(x,y) (x > y ? x : y)
#define MIN(x,y) (x < y ? x : y)
#define INF (long long int)(9223372036854775807)
#define IINF (int)(2147483647)

int main(void) {
  lld n, m, c = 0;
  scanf("%lld%lld", &n, &m);
  for (lld i = m; i <= n + 1; i++) {
    c += (n - i + 1) * i + 1;
    c %= 1000000007;
  }
  printf("%lld\n", c);
}