#include <bits/stdc++.h>
using namespace std;
double esp = 1e-11;
#pragma comment(linker, "/STACK:1024000000,1024000000")
const double PI = acos(-1.0);
const long long int INF = 0x3f3f3f3f3f3f3f3f;
const long long int MOD = 1000000007;
const int maxn = 1050;
int main() {
  long long int n, m;
  scanf("%I64d%I64d", &n, &m);
  long long int ans = ((n % MOD) * (m % MOD)) % MOD;
  long long int o = (long long int)sqrt(n + 0.5), t;
  long long int i = 1, l = min(n, m), tem;
  for (; i <= l; i++) {
    if (i <= o)
      ans = (ans - (n / i) * i) % MOD;
    else {
      t = n / (n / i);
      if (t > m) t = m;
      if ((i + t) & 1)
        tem = (((i + t) % MOD) * ((t - i + 1) / 2 % MOD)) % MOD;
      else
        tem = (((i + t) / 2 % MOD) * ((t - i + 1) % MOD)) % MOD;
      tem = (tem * (n / i)) % MOD;
      ans = (ans - tem) % MOD;
      i = t;
    }
  }
  if (ans < 0) ans = (ans + MOD) % MOD;
  printf("%I64d\n", ans);
  return 0;
}
