#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 7;
const long long MOD = 1e9 + 7;
long long mult(long long x, long long y) {
  return ((x % MOD) * (y % MOD)) % MOD;
}
long long sub(long long x, long long y) { return (x - y + MOD) % MOD; }
long long calc(long long x) {
  long long a = x;
  long long b = x + 1;
  if (a % 2 == 0)
    a /= 2;
  else
    b /= 2;
  return mult(a, b) % MOD;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(12);
  cout << fixed;
  long long n, m;
  cin >> n >> m;
  long long v1 = mult(n, m);
  long long v2 = 0;
  long long d_last = 1;
  for (long long d = 1; d <= m && d * d <= n; ++d) {
    (v2 += mult(n / d, d)) %= MOD;
    d_last = d;
  }
  long long v3 = 0;
  for (long long v = 1; v < n / d_last && v * v <= n; ++v) {
    if (v * v == n && v <= m) continue;
    long long l = n / (v + 1);
    long long r = min(m, n / v);
    if (l > r) continue;
    long long tmp = mult(v, sub(calc(r), calc(l)));
    (v3 += tmp) %= MOD;
  }
  long long res = sub(sub(v1, v2), v3);
  cout << res << '\n';
  return 0;
}
