#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
int composition(long long x, long long y) {
  x %= MOD;
  y %= MOD;
  return (int)((x * y) % MOD);
}
int addition(int x, int y) {
  long long res = (long long)x + (long long)y;
  res %= MOD;
  return (int)res;
}
int subtraction(int x, int y) {
  long long res = (long long)x - (long long)y + MOD;
  res %= MOD;
  return (int)res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, m;
  cin >> n >> m;
  int sum = 0;
  long long minValue = min(n, m);
  for (long long i = 1; i * i <= min(n, m); i++) {
    long long l = n / (i + 1LL), r = min(n / i, m);
    if (l < r) {
      minValue = l;
      sum = addition(sum,
                     composition(i, composition(composition(l + r + 1LL, r - l),
                                                (MOD + 1LL) / 2LL)));
    }
  }
  for (long long i = 1; i <= minValue; i++) {
    sum = addition(sum, composition(i, n / i));
  }
  cout << subtraction(composition(n, m), sum);
  return 0;
}
