#include <bits/stdc++.h>
using namespace std;
int main() {
  long long i, n, k, ans = 0, Mod = 1000000007;
  cin >> k >> n;
  for (i = 1; i <= n; i++) {
    long long a = k / i, l, r, tmp;
    l = k / (a + 1) + 1;
    r = a ? k / a : n;
    r = min(r, n);
    if ((l + r) % 2)
      tmp = ((r - l + 1) / 2) % Mod * ((l + r) % Mod) % Mod;
    else
      tmp = ((l + r) / 2) % Mod * ((r - l + 1) % Mod) % Mod;
    ans +=
        (k % Mod) * ((r - l + 1) % Mod) % Mod - (a % Mod) * (tmp % Mod) % Mod;
    ans %= Mod;
    ans = (ans + Mod) % Mod;
    i = r;
  }
  cout << ans << endl;
  return 0;
}
