#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
long long int leap(long long int x) {
  if ((x % 4 == 0 && x % 100 != 0) || x % 400 == 0) return 1;
  return 0;
}
long long int nCr(long long int n, long long int r) {
  if (r == 0)
    return 1;
  else
    return nCr(n - 1, r - 1) * n / r;
}
long long int mod(long long int N, long long int M) {
  long long int temp = N / M;
  N -= temp * M;
  return N;
}
long long int bigmod(long long int N, long long int M, long long int MOD) {
  if (M == 0) return 1;
  if ((M / 2) * 2 == M) {
    long long int ret = bigmod(N, M / 2, MOD);
    return ((ret % MOD) * (ret % MOD)) % MOD;
  } else
    return ((N % MOD) * bigmod(N, M - 1, MOD) % MOD) % MOD;
}
long long int modinverse(long long int a, long long int m) {
  return bigmod(a, m - 2, m);
}
struct Euclid {
  long long int x, y, d;
  Euclid(){};
  Euclid(long long int xx, long long int yy, long long int dd) {
    x = xx, y = yy, d = dd;
  }
};
Euclid Extended_gcd(long long int a, long long int b) {
  if (!b) return Euclid(1, 0, a);
  Euclid e = Extended_gcd(b, a % b);
  return Euclid(e.y, e.x - a / b * e.y, e.d);
}
long long int Set(long long int N, long long int pos) {
  return N | (1LL << pos);
}
long long int reset(long long int N, long long int pos) {
  return N & ~(1LL << pos);
}
long long int check(long long int N, long long int pos) {
  return (N & (1LL << pos));
}
int main() {
  long long int n, m, i, j, res;
  while (cin >> n >> m) {
    res = ((n % 1000000007) * (m % 1000000007)) % 1000000007;
    long long int cnt = 0;
    long long int sq = sqrt(n);
    for (i = 1; i <= sq && i <= m; i++) {
      cnt = (cnt + (n / i) * i) % 1000000007;
    }
    for (i = 1; i <= sq; i++) {
      long long int a = n / i;
      long long int b = n / (i + 1);
      if (a > m) a = m;
      if (b > m) continue;
      long long int temp = b;
      a = ((a % 1000000007) * ((a + 1) % 1000000007)) % 1000000007;
      a = ((a % 1000000007) * (1000000007 + 1) / 2) % 1000000007;
      b = ((b % 1000000007) * ((b + 1) % 1000000007)) % 1000000007;
      b = ((b % 1000000007) * (1000000007 + 1) / 2) % 1000000007;
      cnt = (cnt + ((a - b) * i) % 1000000007) % 1000000007;
      while (cnt < 0) cnt += 1000000007;
      if (temp < sq) {
        cnt = (cnt - (sq * sq) % 1000000007) % 1000000007;
        while (cnt < 0) cnt += 1000000007;
      }
    }
    res = res - cnt;
    while (res < 0) res += 1000000007;
    cout << res << endl;
  }
  return 0;
}
