#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <queue>
#include <vector>

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
template <class T>
using vv = vector<vector<T>>;

#define in(v) \
  v;          \
  cin >> v;
// #define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define all(f, c, ...)                                 \
  (([&](decltype((c)) cccc) {                          \
    return (f)(begin(cccc), end(cccc), ##__VA_ARGS__); \
  })(c))
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) for (int i = 0, _i = (n); i < _i; ++i)
#define repi(i, a, b) for (int i = (a), _i = (b); i < _i; ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)

#define rrep(i, n) for (int i = (n); i >= 0; --i)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
template <class T>
bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}

// debug
template <class T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
  os << "{";
  for (size_t i = 0; i < vec.size(); ++i) os << (i ? ", " : "") << vec[i];
  os << "}";
  return os;
}
ostream& operator<<(ostream& os, const vector<char>& v) {
  for (size_t i = 0; i < v.size(); ++i) os << v[i];
  return os;
}
template <class T1, class T2>
ostream& operator<<(ostream& os, const pair<T1, T2>& rhs) {
  os << "(" << rhs.first << ", " << rhs.second << ")";
  return os;
}

#ifdef LOCAL
void debug() { cerr << "\n"; }
template <class First>
void debug(const First& first) {
  cerr << first << "\n";
}
template <class First, class... Rest>
void debug(const First& first, const Rest&... rest) {
  cerr << first << ",";
  debug(rest...);
}
#else
#define debug(...) 42
#endif

template <int MOD>
struct MInt {
  long long val;
  MInt(long long val = 0) : val(val % MOD) {
    if (val < 0) val += MOD;
  }
  MInt operator-() const { return MInt(-val); }
  MInt operator+(const MInt& n) const { return MInt(val) += n; }
  MInt operator-(const MInt& n) const { return MInt(val) -= n; }
  MInt operator*(const MInt& n) const { return MInt(val) *= n; }
  MInt operator/(const MInt& n) const { return MInt(val) /= n; }
  MInt& operator+=(const MInt& n) {
    val = (val + n.val) % MOD;
    return *this;
  }
  MInt& operator-=(const MInt& n) {
    val = (MOD + val - n.val) % MOD;
    return *this;
  }
  MInt& operator*=(const MInt& n) {
    val = (val * n.val) % MOD;
    return *this;
  }
  MInt& operator/=(const MInt& n) {
    val = (*this * n.inv()).val;
    return *this;
  }
  bool operator==(const MInt& n) { return val == n.val; }
  bool operator!=(const MInt& n) { return val != n.val; }
  MInt pow(long long n) const {
    MInt pow = val, ans = 1;
    for (long long p = n; p > 0; p >>= 1) {
      if (p & 1) ans *= pow;
      pow *= pow;
    }
    return ans;
  }
  MInt inv() const { return pow(MOD - 2); }
  friend ostream& operator<<(ostream& os, const MInt& n) {
    os << n.val;
    return os;
  }
  friend istream& operator>>(istream& os, MInt& n) {
    os >> n.val;
    return os;
  }
};

using mint = MInt<1000000007>;

int main() {
  ll N, K;
  in(N);
  in(K);

  mint ans;
  rep(k, K, N + 2) {
    // debug(k, (N+1 - k) * k + 1);
    ans += (N+1 - k) * k + 1;
  }
  cout << ans << endl;
  return 0;
}
// 再帰的に解けそう
// N個から2つ選ぶのはN + (N-1) = 2 * N - 1
// N個から3つ選ぶのは(N-1個から2つ選ぶ) + (N-2個から2つ)
// N個から3つ選ぶのは(N-1個から3つ選ぶ) + (N-2個から3つ)
// N個から

Measured memory_bytes: 3644