#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int main() {
  long long n, m, ans = 0, cnt = 0;
  scanf("%lld%lld", &n, &m);
  ans = ((n % mod) * (m % mod)) % mod;
  for (long long i = 1; i <= m; ++i) {
    if (n / i == 0) break;
    long long p = min(n / (n / i), m);
    if ((p - i + 1) % 2) {
      ans -=
          ((((p + i) / 2) % mod) * ((p - i + 1) % mod)) % mod * (n / i) % mod;
    } else
      ans -=
          (((p + i) % mod) * (((p - i + 1) / 2) % mod)) % mod * (n / i) % mod;
    if (ans < 0) ans += mod;
    i = (n / (n / i));
  }
  printf("%lld\n", ans);
  return 0;
}
