#include <bits/stdc++.h>
using namespace std;
struct P {
  int x, y, z;
  bool operator<(const P &a) const { return z > a.z; }
};
vector<int> v[1111];
int a, i, b, n, d, c, m, k;
int o[1111];
int l[1111];
int j[1111];
int e;
int dx[10] = {2, 2, -2, -2, 1, 1, -1, -1},
    dy[10] = {1, -1, 1, -1, 2, -2, 2, -2};
long long mod = 1000000007, mod2 = 1000000009, mod3 = 2017;
long long x, z, y;
double pi = 3.14159265;
P u[322221];
stack<int> s;
queue<int> q;
bool as(P a, P b) { return a.x < b.x; }
long long f(long long n) {
  long long m = n + 1;
  if (m % 2)
    n /= 2;
  else
    m /= 2;
  n %= mod;
  m %= mod;
  return n * m % mod;
}
int main() {
  long long a, b, n;
  scanf("%lld %lld", &b, &a);
  if (a > b)
    x = b % mod * ((a - b) % mod) % mod, n = b;
  else
    n = a;
  for (long long i = 2; b / i > 1000000; i++)
    if (n > b / i) {
      long long p = min(b / (i - 1), n);
      x += b % mod * ((p - b / i) % mod) % mod -
           ((f(p) - f(b / i) + mod) % mod) * (i - 1) % mod;
      x %= mod;
      x += mod;
      x %= mod;
      n = b / i;
    }
  for (; n; n--) x += b % n, x %= mod;
  printf("%lld", x);
}
