#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, ans = 0;
  cin >> n >> m;
  for (long long i = 1; i * i <= n; i++) {
    if (i > m) break;
    ans += n % i;
    long long up, down, x, y;
    up = n / i;
    down = n / (i + 1) + 1;
    if (up != i) {
      if (m >= up) {
        long long e = up - down + 1;
        x = e, y = e - 1;
        long long d = i;
        long long a = n % up;
        if (e % 2 == 0)
          x /= 2;
        else
          y /= 2;
        ans += ((a % 1000000007) * (e % 1000000007)) % 1000000007 +
               ((((x % 1000000007) * (y % 1000000007)) % 1000000007) * d) %
                   1000000007;
        ans = ans % 1000000007;
      } else if (m < up && m >= down) {
        long long e = m - down + 1;
        x = e, y = e - 1;
        long long d = i;
        long long a = n % m;
        if (e % 2 == 0)
          x /= 2;
        else
          y /= 2;
        ans += ((a % 1000000007) * (e % 1000000007)) % 1000000007 +
               ((((x % 1000000007) * (y % 1000000007)) % 1000000007) * d) %
                   1000000007;
        ans = ans % 1000000007;
      }
    }
  }
  if (m > n) ans += (((m - n) % 1000000007) * (n % 1000000007)) % 1000000007;
  cout << ans;
  return 0;
}
