#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:255000000")
bool firstout = 1;
template <class T>
T &minn(T &a, T b) {
  if (b < a) a = b;
  return a;
}
template <class T>
T &maxx(T &a, T b) {
  if (a < b) a = b;
  return a;
}
int &madd(int &a, int b) {
  a += b;
  if (a >= 1000000007) a -= 1000000007;
  return a;
}
int &msub(int &a, int b) {
  a -= b;
  if (a < 0) a += 1000000007;
  return a;
}
int &mmult(int &a, int b) { return a = (long long)a * b % 1000000007; }
int mdiv(long long a, long long b, long long m) {
  a = (a % m + m) % m;
  b = (b % m + m) % m;
  if (a % b == 0) return a / b;
  return (a + m * mdiv(-a, m, b)) / b;
}
long long n, m;
int A[1012];
int main() {
  char c;
  int a, d;
  int ts;
  for (ts = 1; scanf("%"
                     "I64d",
                     &(n)) > 0;
       ++ts) {
    long long i, j;
    scanf(
        "%"
        "I64d",
        &(m));
    int res = 0;
    for (i = 1; i <= m; i = j + 1) {
      long long d = n / i;
      j = d == 0 ? m : n / d;
      minn(j, m);
      int r = n % i % 1000000007;
      madd(r, n % j % 1000000007);
      r = mdiv(r, 2, 1000000007);
      mmult(r, (j - i + 1) % 1000000007);
      madd(res, r);
    }
    printf(
        "%"
        "d",
        (res));
    printf("\n"), firstout = 1;
  }
  return 0;
}
