#include <bits/stdc++.h>
using namespace std;
const long long N = 500005;
const long long mod = 1e9 + 7;
long long f(long long l, long long r) {
  l %= mod;
  r %= mod;
  long long x = r % mod * (r + 1) % mod - l % mod * (l + 1) % mod;
  x = (x + mod) % mod;
  x = x * 500000004 % mod;
  return x % mod;
}
void solve() {
  long long x = 0, y = 0, c = 0, ans = 0;
  long long n, m, k;
  cin >> n >> m;
  ans = (n % mod) * (m % mod) % mod;
  k = m;
  for (long long i = 1; i * i <= n; ++i) {
    y = min(m, n / i);
    x = n / (i + 1);
    if (x >= y) continue;
    k = x;
    c = (c + (i * f(x, y)) % mod) % mod;
    x = i;
  }
  for (long long i = 1; i <= k and i <= m; ++i) {
    c = (c + (n / i) * i) % mod;
  }
  cout << ((ans - c + mod) % mod) << "\n";
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}
