import std.stdio, std.conv, std.string, std.algorithm,
       std.math, std.array, std.container, std.typecons;

long mod = 1000000007;
long n;

long solve(long l) {
  long min = l*(l-1)/2;
  long max = n*(n+1)/2 - (n-l+1)*(n-l)/2;
  return max-min+1;
}

void main() {
  long k;
  readf("%d %d\n", &n, &k);
  long res = 0;
  for(long i=k; i<=n+1; i++) {
    res += solve(i) % mod;
    res %= mod;
  }
  writeln(res);
}
