#include <bits/stdc++.h>
using namespace std;
const int MXN = (int)1e6 + 10;
const int INF = (int)1e9 + 7;
const long long LINF = (long long)1e18;
const double EPS = (double)1e-9;
const double PI = (double)acos(-1.0);
inline void add(long long &x, long long y) {
  x += y;
  if (x >= INF) x -= INF;
}
inline long long binmult(long long x, long long y) {
  long long res = 0LL;
  x %= INF;
  y %= INF;
  if (y > x) swap(x, y);
  while (y) {
    if (y & 1) add(res, x);
    add(x, x);
    y >>= 1;
  }
  return res;
}
inline long long binpow(long long x, long long y) {
  long long res = 1LL;
  while (y) {
    if (y & 1) res = (res * x) % INF;
    x = (x * x) % INF;
    y >>= 1;
  }
  return res;
}
inline long long get(long long x) {
  if (x <= 1LL) return x;
  long long val1 = x;
  long long val2 = (x + 1LL);
  ((val1 & 1) ? val2 : val1) /= 2LL;
  return binmult(val1, val2);
}
inline long long sum(long long l, long long r) {
  return (get(r) - get(l - 1LL) + INF) % INF;
}
long long n, m;
long long ans;
int main() {
  cin >> n >> m;
  long long l, r;
  for (long long i = 1; i <= min(n, m); i = (n / (n / i)) + 1LL) {
    l = i;
    r = min((n / (n / i)), m);
    ans += (sum(l, r) * (n / i)) % INF;
    ans %= INF;
  }
  cout << ((binmult(n, m) - ans) % INF + INF) % INF;
  return 0;
}
