#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
long long ans, n, m, inv, k, l, r;
long long power(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) {
      res = (1ll * res * a) % mod;
    }
    a = (1ll * a * a) % mod;
    b /= 2;
  }
  return res;
}
int main() {
  inv = power(2, mod - 2) % mod;
  cin >> n >> m;
  ans = (n % mod) * (m % mod);
  ans %= mod;
  while (m) {
    k = (n / m);
    l = (n / (k + 1)) + 1;
    r = m;
    ans = (((ans -
             ((((l + r) % mod) * ((r - l + 1) % mod)) % mod * k % mod * inv) %
                 mod) +
            mod) %
           mod);
    m = l - 1;
  }
  cout << ans << endl;
}
