#include <bits/stdc++.h>
using namespace std;
const long long MO = 1e9 + 7;
const long long INV_2 = 5e8 + 4;
int main() {
  long long n, m;
  cin >> n >> m;
  long long ans = ((n % MO) * (m % MO)) % MO;
  for (long long i = 1, l, r; i <= min(n, m); i = r + 1) {
    l = i;
    r = n / (n / i);
    if (r >= m) r = m;
    long long sum =
        (r % MO - l % MO + 1 + MO) % MO * ((l + r) % MO) % MO * INV_2 % MO;
    sum = sum * ((n / i) % MO) % MO;
    ans = (ans - sum + MO) % MO;
  }
  cout << ans << endl;
  return 0;
}
