#include <stdio.h>

long calc(int max, int count) {
  int i;
  long mx = 0, mn = 0;
  for(i = 0;i < count;i++) {
    mn += i;
    mx += max - i;
  }
  mx = max * count - mn;
  return mx - mn + 1;
}

int main(void) {
  int n, k;
  
  scanf("%d %d", &n, &k);
  if(k > n) {
    printf("1\n");
    return 0;
  }
  int i;
  long ret = 0;
  for(i = k;i <= n + 1;i++) {
    ret += calc(n, i);
  }
  ret %= 1000000007;
  printf("%ld\n", ret);
  return 0;
}
  
