#include <bits/stdc++.h>
using namespace std;
int Move[8][2] = {{0, 1}, {1, 0},  {0, -1}, {-1, 0},
                  {1, 1}, {-1, 1}, {1, -1}, {-1, -1}};
void sync() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
double distance0(double x, double y) { return sqrt(x * x + y * y); }
double Distance(double x1, double y1, double x2, double y2) {
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
pair<pair<double, double>, pair<double, double>> circlesller(
    double x1, double y1, double r1, double x2, double y2, double r2) {
  double d = Distance(x1, y1, x2, y2);
  double l = (r1 * r1 - r2 * r2 + d * d) / (2 * d);
  double h = sqrt(r1 * r1 - l * l);
  double x = (l / d) * (x2 - x1) + (h / d) * (y2 - y1) + x1;
  double xx = (l / d) * (x2 - x1) - (h / d) * (y2 - y1) + x1;
  double yy = (l / d) * (y2 - y1) + (h / d) * (x2 - x1) + y1;
  double y = (l / d) * (y2 - y1) - (h / d) * (x2 - x1) + y1;
  return {{x, y}, {xx, yy}};
}
long long sum1n(long long n) {
  if (n <= 0) return 0;
  if (n % 2 == 0) {
    return (((n / 2LL) % 1000000007) * ((n + 1) % 1000000007)) % 1000000007;
  } else
    return ((((n + 1) / 2LL) % 1000000007) * (n % 1000000007)) % 1000000007;
}
long long suminrange(long long l, long long r) {
  if (r < l) return 0;
  long long all = sum1n(r);
  long long po = sum1n(l - 1);
  return (((all - po) % 1000000007) + 1000000007) % 1000000007;
}
void _new() { return; }
int main() {
  long long n, m;
  cin >> n >> m;
  long long ans = (n % 1000000007) * (m % 1000000007);
  m = min(n, m);
  ans %= 1000000007;
  long long fo = m;
  for (long long i = 1; i * i <= n; i++) {
    long long up = n / i;
    long long down = n / (i + 1);
    fo = min(fo, down);
    ans -= i * suminrange(down + 1, min(m, up));
    ans %= 1000000007;
    ans += 1000000007;
    ans %= 1000000007;
  }
  for (int i = 1; i <= fo; i++) {
    ans -= (i) * (n / i);
    ans %= 1000000007;
    ans += 1000000007;
    ans %= 1000000007;
  }
  cout << ans;
}
