#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int main() {
  unsigned long long n, m;
  while (cin >> n >> m) {
    unsigned long long sum = (n % MOD) * (m % MOD) % MOD;
    m = min(m, n);
    unsigned long long sum1;
    sum1 = 0;
    for (unsigned long long l = 1, r; l <= m; l = r + 1) {
      r = min(n / (n / l), m);
      unsigned long long len = (r - l + 1);
      unsigned long long a = (l + r);
      if (a % 2) {
        len /= 2;
      } else
        a /= 2;
      sum1 = (sum1 + ((a % MOD) * (len % MOD)) % MOD * ((n / l) % MOD)) % MOD;
    }
    cout << (sum - sum1 + MOD) % MOD << endl;
  }
  return 0;
}
