#include <bits/stdc++.h>
using namespace std;
int R() {
  int x;
  scanf("%d", &x);
  return x;
};
const int mod = 1e9 + 7;
unsigned long long sum(long long x) {
  x %= mod;
  unsigned long long res = x * (x + 1) / 2LL;
  return res % mod;
}
stack<unsigned long long> st;
int main() {
  unsigned long long n, m;
  cin >> n >> m;
  unsigned long long ans = 0;
  if (m > n) ans = (((m - n) % mod) * (n % mod)) % mod;
  unsigned long long d = 2;
  unsigned long long pop = min(n, m);
  while (d * d <= n) {
    unsigned long long val = n / d;
    st.push(n / d + 1);
    if (pop > val) {
      unsigned long long s = sum(pop - val - 1);
      s = (s * (d - 1) % mod) % mod;
      s = (s + ((n % pop) % mod) * ((pop - val) % mod)) % mod;
      ans = (ans + s) % mod;
    }
    pop = min(n / d, pop);
    d++;
  }
  st.push(d);
  while (!st.empty()) {
    st.pop();
    unsigned long long val = n / d;
    if (pop > val) {
      unsigned long long s = sum(pop - val - 1);
      s = (s * (d - 1) % mod) % mod;
      s = (s + ((n % pop) % mod) * ((pop - val) % mod)) % mod;
      ans = (ans + s) % mod;
    }
    pop = min(n / d, pop);
    if (!st.empty()) d = st.top();
  }
  cout << ans;
  return 0;
}
