#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long s(long long y) {
  long long a = y;
  long long b = y + 1;
  if (a & 1)
    b /= 2;
  else
    a /= 2;
  a %= mod;
  b %= mod;
  return (a * b) % mod;
}
long long sum(long long x, long long y) {
  long long r = s(y);
  r -= s(x - 1);
  if (r < 0) r += mod;
  return r;
}
long long solve(long long n, long long m) {
  long long sol = ((n % mod) * (m % mod)) % mod;
  bool done = 0;
  for (long long i = 1;;) {
    long long c = n / i;
    long long j = n / c;
    c %= mod;
    if (j >= m) {
      j = m;
      done = 1;
    }
    sol -= (sum(i, j) * c) % mod;
    if (sol < 0) sol += mod;
    i = j + 1;
    if (done) break;
  }
  return sol;
}
int main() {
  cin.sync_with_stdio(false);
  long long n, m;
  cin >> n >> m;
  long long sol = 0;
  if (n < m) {
    sol = n % mod;
    sol *= (m - n) % mod;
    sol %= mod;
    m = n;
  }
  sol = (sol + solve(n, m)) % mod;
  cout << sol;
  return 0;
}
