#include <iostream>

using namespace std;

int n, k;
long long maxsum, minsum, sum[200001], r;
int mod = 1000000007;

int main()
{
  cin >> n >> k;
  for (int i = 1; i <= n; i++)
    sum[i] = sum[i - 1] + i;
  for (int i = k; i <= n + 1; i++) {
    minsum = sum[i - 1];
    maxsum = sum[n] - sum[n - i];
    r += (maxsum - minsum + 1);
    r %= mod;
  }
  cout << r % mod;
  return 0;
}
