#include <bits/stdc++.h>
using namespace std;
const long long mod = (long long)(1e9 + 7);
const long long inv = (long long)(5e8 + 4);
int main() {
  long long n, m;
  cin >> n >> m;
  long long ans = (n % mod) * (m % mod) % mod;
  long long l = 1, r = 1;
  while (l <= min(n, m)) {
    long long a = n / l;
    r = min(m, n / a);
    long long x1, x2, x3, x4;
    x1 = (n / r) % mod;
    x2 = (l + r) % mod;
    x3 = (x1 * x2) % mod;
    x4 = (r - l + 1) % mod;
    long long temp = ((x3 * x4) % mod) * inv % mod;
    ans = ((ans + mod) - temp) % mod;
    l = r + 1;
  }
  cout << ans << endl;
  return 0;
}
