#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
const long long int Rev = (mod + 1) >> 1;
int main() {
  long long int a, b;
  cin >> a >> b;
  long long int Res = (a % mod) * (b % mod) % mod;
  for (long long int i = 1; i <= b;) {
    long long int t = a / i;
    if (!t) break;
    long long int x = min(b, a / t) + 1LL;
    long long int y = (i + x - 1) % mod * ((x - i) % mod) % mod * Rev % mod;
    Res = (Res - y * (t % mod) % mod + mod) % mod;
    i = x;
  }
  cout << Res << "\n";
  return 0;
}
