#include <bits/stdc++.h>
using namespace std;
long long exp(long long x, long long y) {
  x %= 1000000007;
  long long res = 1;
  while (y) {
    if (y & 1) res = res * x % 1000000007;
    x = x * x % 1000000007;
    y >>= 1;
  }
  return res;
}
long long fact(long long n) {
  long long res = 1;
  for (long long i = 2; i <= n; ++i) (res *= i) %= 1000000007;
  return res;
}
bool isprime(long long n) {
  for (long long i = 2; i * i <= n; ++i)
    if (n % i == 0) return 0;
  return 1;
}
int main() {
  ios_base::sync_with_stdio(0);
  long long n, m;
  cin >> n >> m;
  long long ans = ((n % 1000000007) * (m % 1000000007)) % 1000000007;
  long long sum = 0;
  m = min(n, m);
  long long val = m;
  for (long long i = 1; i * i <= m; ++i) {
    long long lf = n / (i + 1), rg = min(m, n / i);
    if (lf >= rg) continue;
    val = lf;
    lf %= 1000000007;
    rg %= 1000000007;
    long long tmp =
        (((rg * (rg + 1)) % 1000000007) * (1000000007 + 1) / 2) % 1000000007 -
        (((lf * (lf + 1)) % 1000000007) * (1000000007 + 1) / 2) % 1000000007;
    if (tmp < 0) tmp += 1000000007;
    tmp %= 1000000007;
    (tmp *= i) %= 1000000007;
    sum = (sum + tmp) % 1000000007;
  }
  for (long long i = 1; i <= val; ++i) {
    sum = (sum + (i * (n / i)) % 1000000007) % 1000000007;
  }
  cout << (ans - sum + 1000000007) % 1000000007;
  return 0;
}
