#include <bits/stdc++.h>
using namespace std;
long long n, m, b, c, l, r, mod = 1000000007;
long long rem(long long a) {
  a %= mod;
  if (a < 0) {
    a += mod;
  }
  return a;
}
long long add(long long a, long long b) { return rem(rem(a) + rem(b)); }
long long sub(long long a, long long b) { return rem(rem(a) - rem(b)); }
long long mul(long long a, long long b) { return rem(rem(a) * rem(b)); }
int main() {
  cin >> n >> m;
  long long a = mul(n, m), res = 0;
  m = min(m, n);
  long long mv = m;
  for (long long i = 1; i * i <= n; i++) {
    if (n / (i + 1) < min(n / i, m)) {
      mv = n / (i + 1);
      l = min(n / i, m);
      r = n / (i + 1);
      if (l % 2) {
        b = mul(l, (l + 1) / 2);
      } else {
        b = mul(l / 2, l + 1);
      }
      if (r % 2) {
        c = mul(r, (r + 1) / 2);
      } else {
        c = mul(r / 2, r + 1);
      }
      res = add(res, mul(i, sub(b, c)));
    }
  }
  for (long long i = 1; i <= mv; i++) {
    res = add(res, mul(n / i, i));
  }
  cout << sub(a, res) << endl;
  return 0;
}
