#include <bits/stdc++.h>
#pragma GCC optimize("-O2")
using namespace std;
void err(istream_iterator<string> it) { cerr << endl; }
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << "\t";
  err(++it, args...);
}
template <typename T1, typename T2>
ostream& operator<<(ostream& c, pair<T1, T2>& v) {
  c << "(" << v.first << "," << v.second << ")";
  return c;
}
template <template <class...> class TT, class... T>
ostream& operator<<(ostream& out, TT<T...>& c) {
  out << "{ ";
  for (auto& x : c) out << x << " ";
  out << "}";
  return out;
}
const int LIM = 1e5 + 5, MOD = 1e9 + 7;
long long int n, m;
long long int inv2 = 5e8 + 4;
long long int sum(long long int a, long long int b) {
  long long int terms = (b - a + 1) % MOD;
  return ((terms * ((a + b) % MOD)) % MOD) * inv2 % MOD;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  long long int ans = (n % MOD) * (m % MOD) % MOD;
  long long int fans = 0;
  for (long long int i = 1, la; i <= min(m, n); i = la + 1) {
    la = n / (n / i);
    if (la > m) la = m;
    fans += ((n / i) % MOD) * sum(i, la) % MOD;
    fans %= MOD;
  }
  ans += MOD - fans;
  ans %= MOD;
  cout << ans << "\n";
  return 0;
}
