#include <bits/stdc++.h>
using namespace std;
inline long long sum(long long x) {
  x %= 1000000007;
  return (1LL * x * (x + 1) / 2) % 1000000007;
}
int main() {
  long long n, m;
  ios::sync_with_stdio(false);
  cin >> n >> m;
  long long ans = ((n % 1000000007) * (m % 1000000007)) % 1000000007;
  int rad = sqrt(n);
  for (int i = 1; i <= n / (rad + 1) && i <= m; i++) {
    ans -= (1LL * i * (n / i)) % 1000000007;
    if (ans < 0) ans += 1000000007;
  }
  for (int i = 1; i <= rad; i++) {
    ans -= (1LL * i *
            (sum(min(n / i, m)) - sum(min(n / (i + 1), m)) + 1000000007)) %
           1000000007;
    if (ans < 0) ans += 1000000007;
  }
  cout << ans;
  return 0;
}
