#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t

#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))
#define BUF_SIZE 30

int get_int2(int *a1, int *a2) {
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return -1;
  sscanf(line, "%d %d", a1, a2);
#else
#error
#endif
  return 0;
}

#define DIVISOR 1000000007

int main(void) {
    int n, llimit;
    get_int2(&n, &llimit);
    uint64_t k;
    uint64_t sum = 0;
    for(k = llimit; k <= n+1; k++) {
        sum = (sum + k*(n-k+1)+1)%DIVISOR;
    }
    printf("%d\n", (int)sum);
    return 0;
}