#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e6 + 50;
const long long mod = 1e9 + 7;
long long inv = (mod + 1LL) / 2LL;
long long MOD(long long n) { return n % mod; }
signed main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  long long n, k;
  cin >> n >> k;
  long long ans = (n % mod) * (k % mod) % mod, sum = 0LL;
  for (long long x = 1LL, gx; x <= k; x = gx + 1LL) {
    gx = n / x ? min(n / (n / x), k) : k;
    sum = (sum + MOD(n / x) * MOD(x + gx) % mod * MOD(gx - x + 1LL) % mod *
                     inv % mod) %
          mod;
  }
  cout << ((ans - sum) % mod + mod) % mod << "\n";
}
