#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const unsigned long long mod = 1e9 + 7;
unsigned long long progr(unsigned long long a, unsigned long long b) {
  unsigned long long t1 = (a + b);
  t1 %= mod;
  unsigned long long t2 = (b - a + 1);
  t2 %= mod;
  t1 *= t2;
  t1 %= mod;
  if (t1 & 1) {
    t1 += mod;
  }
  t1 = t1 >> 1;
  return t1;
}
unsigned long long solve(unsigned long long n, unsigned long long m) {
  unsigned long long res = ((n % mod) * (m % mod)) % mod;
  for (unsigned long long i = m; i != 0;) {
    unsigned long long mn = n / i;
    unsigned long long next_i = n / ((n / i) + 1);
    unsigned long long tmp = ((mn % mod) * progr(next_i + 1, i)) % mod;
    if (res < tmp) {
      res += mod;
    }
    res -= tmp;
    i = next_i;
  }
  return res;
}
unsigned long long brute_solve(unsigned long long n, unsigned long long m) {
  unsigned long long res = 0;
  for (int i = 1; i <= m; ++i) {
    res += n % i;
  }
  return res;
}
int main() {
  unsigned long long n, m;
  cin >> n >> m;
  cout << solve(n, m) << endl;
  return 0;
}
