#include <stdio.h>
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  long long int s=0;

  long long int low[n+1], high[n+1];
  low[0]=0;
  high[0]=n;
  for(int i=1; i<n+1; i++){
    low[i]=low[i-1]+i;
    high[i]=high[i-1]+n-i;
  }
//  for(int i=0; i<n+1; i++){
//    printf("%lld %lld \n", low[i], high[i]);
//  }

  for(int i=k-1;i<n+1;i++){
    s += high[i]-low[i]+1;
    s = s % 1000000007;
  }

  printf("%lld", s);
  return 0;
}
