#include <bits/stdc++.h>
using namespace std;
long long n, m, rs;
const long long mod = 1000000007;
long long add(long long a, long long b) {
  return ((a % mod) + (b % mod)) % mod;
}
long long mult(long long a, long long b) {
  return ((a % mod) * (b % mod)) % mod;
}
long long s(long long a) {
  long long b = a + 1;
  if (!(a % 2))
    a /= 2;
  else
    b /= 2;
  return mult(a, b);
}
int main() {
  cin >> n >> m;
  long long div, l, r;
  for (div = 1; div <= min(n, (long long)5e6); div++) {
    l = n / (div + 1) + 1;
    r = n / div;
    r = min(r, m);
    if (l > r) continue;
    long long sum = s(r) - s(l - 1);
    if (sum < 0) sum += mod;
    rs = add(rs, mult(div, sum));
  }
  for (long long i = 1; i < min(l, m + 1); i++) rs = add(rs, n / i * i);
  rs = mult(n, m) - rs;
  if (rs < 0) rs += mod;
  return cout << rs, 0;
}
