#include <bits/stdc++.h>
using namespace std;
string alpha = "abcdefghijklmnopqrstuvwxyz";
const long long mod = 1e9 + 7;
const long long inf = 1e18 + 5;
const long long nax = 2010;
long long S(long long n) { return ((n % mod) * ((n + 1) % mod) / 2) % mod; }
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, m;
  cin >> n >> m;
  long long res = 0;
  res = (n % mod) * (m % mod) % mod;
  long long cil = 0;
  for (long long i = 1; i * i <= n; ++i) {
    res -= (n / i) * i;
    res %= mod;
    cil = i;
    if (i == m) {
      if (res < 0) {
        res += mod;
      }
      cout << res;
      exit(0);
    }
  }
  ++cil;
  for (long long v = 1; v * v <= n; ++v) {
    long long lf = n / (v + 1) + 1;
    lf = max(cil, lf);
    long long rf = n / v;
    rf = min(m, min(n, rf));
    if (lf > rf) continue;
    long long del = v * (S(rf) - S(lf - 1));
    del %= mod;
    res -= del;
    res %= mod;
  }
  if (res < 0) res += mod;
  cout << res;
  return 0;
}
