#include <bits/stdc++.h>
using namespace std;
const int M = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long int n, m;
  cin >> n >> m;
  long long int sum = ((m % M) * (n % M)) % M, s = 0, r = sqrt(n);
  if (m > n) m = n;
  bool ok = 1;
  for (int i = int(1); i < int(r + 1); i++) {
    if (i > m) {
      ok = 0;
      break;
    }
    s += n / i * i;
    s %= M;
  }
  if (ok)
    for (long long int i = n / r - 1; ok && i >= 1; i--) {
      long long int lo = n / (i + 1), hi = min(n / i, m);
      if (hi == m) ok = 0;
      lo %= M;
      hi %= M;
      s += (((hi * (hi + 1) / 2 - lo * (lo + 1) / 2)) % M) * i;
      s %= M;
    }
  cout << (sum - s + M) % M << endl;
  return 0;
}
