#include <bits/stdc++.h>
using namespace std;
const unsigned int N = 3200000;
const unsigned int mod = 1e9 + 7;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  unsigned long long unsigned int n, m;
  cin >> n >> m;
  unsigned long long unsigned int ans = 0;
  if (m < N) {
    for (unsigned int i = 1; i <= m; i++) {
      ans += n % i;
    }
    cout << ans;
    return 0;
  }
  for (unsigned int i = 1; i < N; i++) {
    ans += n % i;
    ans %= mod;
  }
  ans %= mod;
  for (unsigned int i = 0; i < N; i++) {
    unsigned long long unsigned int a = 0;
    if (i != 0)
      a = max((unsigned long long unsigned int)N - 1,
              min(m, (unsigned long long unsigned int)n / (i)));
    else
      a = m;
    unsigned long long unsigned int l = N - 1, r = m + 1;
    while (r - l > 1) {
      unsigned long long unsigned int mid = (l + r) / 2;
      if (n / mid > i) {
        l = mid;
      } else {
        r = mid;
      }
    }
    unsigned long long unsigned int b = l;
    b++;
    unsigned long long unsigned int c = a - b + 1;
    if (a < b || a < N) {
      continue;
    }
    unsigned long long unsigned int k = n % a;
    unsigned long long unsigned int z = 0;
    if (c % 2 == 0) {
      z = (c / 2 % mod) * ((c - 1) % mod);
      z %= mod;
    } else {
      z = c % mod * ((c - 1) / 2 % mod);
      z %= mod;
    }
    ans += ((c % mod) * (k % mod) + z * i % mod) % mod;
    ans %= mod;
  }
  cout << ans;
}
