#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
const int MOD = 1e9 + 7;
long long int natural(long long int v) {
  long long int a = v, b = v + 1;
  if (a % 2 == 0)
    a /= 2;
  else
    b /= 2;
  a %= MOD;
  b %= MOD;
  return (a * b) % MOD;
}
long long int AP(long long int x, long long int y) {
  x--;
  return (MOD + natural(y) - natural(x)) % MOD;
}
long long int solve(long long int n, long long int m) {
  long long int s = sqrt(n);
  long long int sum = 0;
  for (long long int i = 1; i <= min(m, s); i++) {
    long long int a = (n / i);
    a %= MOD;
    sum += (a) * (i);
    sum %= MOD;
  }
  for (long long int i = s; i >= 1; i--) {
    long long int y = n / i;
    long long int x = n / (i + 1) + 1;
    if (x == s) x++;
    if (x > m) break;
    long long int v = (i);
    if (x > y) continue;
    x = min(x, m);
    y = min(y, m);
    long long int ap = AP(x, y);
    sum += (ap * v);
    sum %= MOD;
    if (x >= m || y >= m) break;
  }
  return sum;
}
int main(int argc, char const *argv[]) {
  cin.sync_with_stdio(0);
  cin.tie(0);
  long long int n, m;
  cin >> n >> m;
  long long int limit = min(n, m);
  long long int diff = max(n, m) - n;
  long long int v = solve(n, limit);
  n %= MOD;
  limit %= MOD;
  diff %= MOD;
  v = ((n * limit) % MOD + MOD - v) % MOD;
  v = (v + (diff * n) % MOD) % MOD;
  cout << v << '\n';
  return 0;
}
