#include <bits/stdc++.h>
using namespace std;
const long long int N = 1e7 + 10, Q = 1e9 + 7;
long long int n, m, sum = 0, ans = 0, x, y, z, ma, mi;
vector<long long int> s[N];
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n >> m;
  ans = 0;
  sum = 0;
  y = floor(sqrt(n));
  y = min(y, m);
  for (long long int i = 1; i <= y; i++) {
    x = n / i, x %= Q;
    ans += (i * x) % Q, ans %= Q;
  }
  ma = min(n, m);
  for (long long int i = 1; i <= y; i++) {
    mi = n / (i + 1);
    mi = max(mi, y);
    mi = min(mi, m);
    x = ma + mi + 1;
    z = ma - mi;
    if (x % 2 == 0)
      x /= 2;
    else
      z /= 2;
    x %= Q, z %= Q;
    x = x * z, x %= Q, x += Q, x %= Q;
    ans += (x * i) % Q, ans %= Q, ans += Q, ans %= Q;
    ma = mi;
  }
  ans = ((n % Q) * (m % Q)) % Q - ans + Q, ans %= Q;
  ans += Q, ans %= Q;
  cout << ans << endl;
}
