#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  const long long MOD = 1e9 + 7;
  long long n, m;
  cin >> n >> m;
  long long S = sqrt(1.0 * n);
  long long ans = n % MOD * 1ll * (m % MOD) % MOD;
  for (long long x = 1; x < S && x <= m; ++x) {
    ans -= x * (n / x) % MOD;
  }
  for (long long i = 1; i <= n / S; ++i) {
    long long l = n / (i + 1) + 1;
    long long r = n / i;
    l = max(l, S);
    r = min(r, m);
    if (l > r) continue;
    long long x = (l + r), y = (r - l + 1);
    if (x & 1) {
      y /= 2;
    } else {
      x /= 2;
    }
    x %= MOD;
    y %= MOD;
    long long z = i % MOD;
    ans -= x * y % MOD * z % MOD;
  }
  ans %= MOD;
  if (ans < 0) ans += MOD;
  cout << ans << endl;
  return 0;
}
