#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
long long n, m;
long long f(long long k) {
  if (k % 2) {
    long long a = ((k + 1) / 2) % MOD;
    long long b = k % MOD;
    a *= b;
    a %= MOD;
    return a;
  } else {
    long long a = (k / 2) % MOD;
    long long b = (k + 1) % MOD;
    a *= b;
    a %= MOD;
    return a;
  }
}
long long calc(long long k) {
  long long left = n / (k + 1) + 1;
  long long right = n / k;
  right = min(right, m);
  long long sum = f(right) - f(left - 1) + MOD;
  if (left > right) sum = 0;
  sum %= MOD;
  sum *= (k % MOD);
  sum %= MOD;
  return sum;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> m;
  long long ans = (n % MOD) * (m % MOD);
  ans %= MOD;
  for (long long i = 1; i * i <= n; i++) {
    ans -= calc(i);
    if (n / i != i) ans -= calc(n / i);
    while (ans < 0) ans += MOD;
  }
  cout << ans;
  return 0;
}
