#include <bits/stdc++.h>
using uint = unsigned int;
using uint64 = unsigned long long;
const uint p = 1000000007;
const uint inv2 = (p + 1) / 2;
template <class _Tp1, class _Tp2>
inline void inc(_Tp1& x, const _Tp2& y) {
  (x >= p - y) ? (x += y - p) : (x += y);
}
template <class _Tp1, class _Tp2>
inline void dec(_Tp1& x, const _Tp2& y) {
  (x < y) ? (x += p - y) : (x -= y);
}
template <class _Tp1, class _Tp2>
inline _Tp1 pls(const _Tp1& x, const _Tp2& y) {
  return (x >= p - y) ? (x - p + y) : (x + y);
}
template <class _Tp>
inline _Tp Min(const _Tp& x, const _Tp& y) {
  return x < y ? x : y;
}
template <class _Tp>
inline _Tp sqr(const _Tp& v) {
  return (uint64)v * v % p;
}
inline uint sum(const uint64& L, const uint64& R) {
  return (R - L + 1LL) % p * pls(L % p, R % p) % p * inv2 % p;
}
uint calc(const uint64& n, const uint64& m) {
  uint Ans = (n % p) * (m % p) % p;
  for (uint64 d = 1, nxd; d <= m && d <= n; d = nxd + 1LL)
    dec(Ans, (n / d) % p * sum(d, nxd = Min(n / (n / d), m)) % p);
  return Ans;
}
int main() {
  uint64 n, m;
  scanf("%llu %llu", &n, &m);
  return printf("%u", calc(n, m)), 0;
}
