#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int main() {
  long long n, m;
  scanf("%lld%lld", &n, &m);
  long long ans1 = ((n % mod) * (m % mod)) % mod;
  long long ans2 = 0LL;
  long long r = 0;
  m = min(n, m);
  for (long long i = 1; i <= m; i++) {
    r = n / (n / i);
    r = min(m, r);
    long long s, t;
    s = (i + r);
    t = (r - i + 1);
    if (s % 2 == 0)
      ans2 = (ans2 % mod +
              (((n / i) % mod) * ((((s / 2) % mod) * (t % mod)) % mod)) % mod) %
             mod;
    else
      ans2 = (ans2 % mod +
              (((n / i) % mod) * (((s % mod) * ((t / 2) % mod)) % mod)) % mod) %
             mod;
    i = r;
  }
  printf("%lld\n", (ans1 - ans2 + mod) % mod);
  return 0;
}
