#include <stdio.h>
#include <math.h>

int main(){
  int N, K;
  scanf("%d %d", &N, &K);
  int i;
  int sum = 0;
  for (i = K; i <= N + 1; i++) {
    int j, min, max;
    min = 0;
    max = 0;
    for (j = 0; j < i; j++) {
      min = min + j;
      max = max + N - j;
    }
    sum = sum + max - min + 1;
  }
  printf("%d", sum % 1000000007);
  return 0;
}