#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= mod;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
const long long inf = 10000000000000000;
const int N = 1005;
long long n, m;
long long sum(long long l, long long r) {
  if (r < l) return 0;
  if ((l + r) % 2 == 0)
    return (((l + r) / 2) % mod) * ((r - l + 1) % mod) % mod;
  return ((l + r) % mod) * (((r - l + 1) / 2) % mod) % mod;
}
int main() {
  cin >> n >> m;
  long long lim = floor(sqrt(n));
  long long ans = ((m % mod) * (n % mod)) % mod;
  long long ans2 = 0;
  long long lim1 = min(lim, m);
  for (int i = 1; i <= lim1; i++)
    ans2 = (ans2 + (long long)i * ((n / (long long)i)) % mod) % mod;
  if (m > lim) {
    long long k1 = n / lim;
    ans2 = (ans2 + (k1 % mod) * (sum(lim + 1, min(n / k1, m)))) % mod;
    if (m > n / k1)
      for (int k = k1 - 1; k >= 1; k--) {
        if (m < n / (k + 1) + 1) break;
        ans2 = (ans2 + (k % mod) * (sum(n / (k + 1) + 1, min(n / k, m)))) % mod;
      }
  }
  cout << (ans + mod - ans2) % mod << endl;
  return 0;
}
