#include <bits/stdc++.h>
using namespace std;
const long long inf = INT_MAX, df = 3e5 + 7, mod = 1e9 + 7;
long long i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z;
long long pw(long long x, long long y) {
  long long ty = 1, tx = x;
  while (y) {
    if (y & 1) (ty *= tx) %= mod;
    y >>= 1, (tx *= tx) %= mod;
  }
  return ty % mod;
}
int main() {
  cin >> n >> m;
  long long ans = 0, ty = pw(2, mod - 2);
  ans = ((n % mod) * (m % mod)) % mod;
  ans %= mod;
  for (long long l = 1, r = 0; l <= min(n, m); l = r + 1) {
    r = n / (n / l);
    r = min(r, m);
    ans -= (((n / l) % mod * ((l + r) % mod) % mod) % mod *
            (((r - l + 1) % mod) % mod * (ty % mod) % mod) % mod) %
           mod;
    ans = (ans % mod + mod) % mod;
  }
  return printf("%lld\n", (ans % mod + mod) % mod), 0;
}
