#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 1;
long long n, m;
long long mult(long long a, long long b) {
  a %= 1000000007;
  b %= 1000000007;
  if (a < 0) a += 1000000007;
  if (b < 0) b += 1000000007;
  return (a * b) % 1000000007;
}
long long ad(long long a, long long b) {
  a %= 1000000007;
  b %= 1000000007;
  return (a + b + 1000000007 + 1000000007) % 1000000007;
}
int main() {
  cin >> n >> m;
  long long ans = mult(n, m);
  long long last = 0;
  for (long long i = 1; i * i <= n && i <= m; ++i) {
    ans = ad(ans, -mult(i, n / i));
    last = i;
  }
  for (long long i = 1; i * i < n; ++i) {
    long long r = min(n / i, m);
    long long l = max(n / (i + 1), last);
    if (l > r) continue;
    long long ch1, ch2;
    if (r & 1)
      ch1 = mult(r, (r + 1) / 2);
    else
      ch1 = mult(r / 2, r + 1);
    if (l & 1)
      ch2 = mult(l, (l + 1) / 2);
    else
      ch2 = mult(l / 2, l + 1);
    ans = ad(ans, mult(i, -ad(ch1, -ch2)));
  }
  cout << ans << endl;
}
