#include <bits/stdc++.h>
using namespace std;
const int mod1 = 1e5 + 7;
const int N = 1e6 + 7;
const long long mod2 = 1e9 + 7;
const long long mod3 = 1e12;
int main() {
  long long n, m, res1, res2 = 0, t, r, l = 1, ans = 0, len, val;
  scanf("%I64d%I64d", &n, &m);
  res1 = ((n % mod2) * (m % mod2)) % mod2;
  if (m >= n) m = n;
  while (l <= m) {
    r = n / (n / l);
    if (r > m) r = m;
    ans = (n / l) % mod2;
    len = r - l + 1;
    val = r + l;
    if (len % 2 == 0)
      len /= 2;
    else
      val /= 2;
    res2 += (ans * (val % mod2) % mod2) * (len % mod2) % mod2;
    res2 = res2 % mod2;
    l = r + 1;
  }
  printf("%I64d\n", (res1 + mod2 - res2) % mod2);
  return 0;
}
