/*
By : Yash Kumar
Dhirubhai Ambani Institute Of Information And Communication Technology, Gandhinagar (DA-IICT GANDHINAGAR)
*/
#include<bits/stdc++.h>

#define lli long long int
#define llu unsigned long long int
#define all(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define si(n) scanf("%d",&n)
#define slli(n) scanf("%lld",&n);
#define ss(n) scanf("%s",n);

const double EPS = 1e-10;
const lli MOD = 1000000007ll;
const lli mod1 = 1000000009ll;
const lli mod2 = 1100000009ll;
const double PI = 3.14159265359;
int INF = 2147483645;
lli INFINF = 9223372036854775807;
int debug = 0;

using namespace std;

lli bit_count(lli _x){lli _ret=0;while(_x){if(_x%2==1)_ret++;_x/=2;}return _ret;}
lli bit(lli _mask,lli _i){return (_mask&(1<<_i))==0?0:1;}
lli powermod(lli _a,lli _b,lli _m){lli _r=1;while(_b){if(_b%2==1)_r=(_r*_a)%_m;_b/=2;_a=(_a*_a)%_m;}return _r;}
lli add(lli a,lli b){lli x=a+b;if(x>=MOD)x-=MOD;return x;}
lli sub(lli a,lli b){lli x=a-b;if(x<0)x+=MOD;return x;}
lli mul(lli a,lli b){lli x=a*b;x%=MOD;return x;}

lli n,m;
lli ans;
bool vis[10000010];
lli k = 1000000;

lli sum(lli x){
    if(x==0)
        return 0;
    x%=MOD;
    lli ret = x*(x+1);
    ret/=2;
    ret%=MOD;
    return ret;
}

lli sum(lli l,lli r){
    lli ret = sub(sum(r),sum(l-1));
    return ret;
}

void brute_force(){
    for(lli i=1;i<=m;i++)
        ans = add(ans,n%i);
    cout<<ans;
    exit(0);
}

int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    debug = 1;
#endif
    srand (time(NULL));

    lli magic = 10000000;
    slli(n);slli(m);
    if(m>=n){
        ans = (ans+((n%MOD)*((m-n)%MOD)))%MOD;
        m=n-1;
    }

    if(m<=10000000){
        brute_force();
    }

    for(lli i=n/m;;i++){
        lli low,high,mid,l=-1,r=-1;
        low = 1;high = m;
        while(low<=high){
            mid = (low + high)>>1;
            lli temp = n/mid;
            if(temp == i)
                l = mid;
            if(temp < i)
                high = mid - 1;
            else if(temp > i)
                low = mid + 1;
            else
                high = mid - 1;
        }
        low = 1;high = m;
        while(low<=high){
            mid = (low+high)>>1;
            lli temp = n/mid;
            if(temp == i)
                r = mid;
            if(temp < i)
                high = mid - 1;
            else if(temp > i)
                low = mid + 1;
            else
                low = mid + 1;
        }
        if(l==-1 || r==-1)
            continue;
        for(lli j=l;j<=magic;j++){
            if(vis[j])
                break;
            vis[j] = true;
        }
        lli sz = r-l+1;
        lli temp1 = (n*sz)%MOD;
        lli temp2 = sum(l,r);
        temp2 = (temp2*i)%MOD;
        lli temp = sub(temp1,temp2);
        ans = add(ans,temp);

        if(l<=magic)
            break;
    }
    for(lli i=1;i<=magic;i++){
        if(vis[i])
            break;
        ans = add(ans,n%i);
    }
    cout<<ans;

    return 0;
}


/*
By : Yash Kumar
Dhirubhai Ambani Institute Of Information And Communication Technology, Gandhinagar (DA-IICT GANDHINAGAR)
*/
#include<bits/stdc++.h>

#define lli long long int
#define llu unsigned long long int
#define all(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define si(n) scanf("%d",&n)
#define slli(n) scanf("%lld",&n);
#define ss(n) scanf("%s",n);

const double EPS = 1e-10;
const lli MOD = 1000000007ll;
const lli mod1 = 1000000009ll;
const lli mod2 = 1100000009ll;
const double PI = 3.14159265359;
int INF = 2147483645;
lli INFINF = 9223372036854775807;
int debug = 0;

using namespace std;

lli bit_count(lli _x){lli _ret=0;while(_x){if(_x%2==1)_ret++;_x/=2;}return _ret;}
lli bit(lli _mask,lli _i){return (_mask&(1<<_i))==0?0:1;}
lli powermod(lli _a,lli _b,lli _m){lli _r=1;while(_b){if(_b%2==1)_r=(_r*_a)%_m;_b/=2;_a=(_a*_a)%_m;}return _r;}
lli add(lli a,lli b){lli x=a+b;while(x>=MOD)x-=MOD;return x;}
lli sub(lli a,lli b){lli x=a-b;while(x<0)x+=MOD;return x;}
lli mul(lli a,lli b){lli x=a*b;x%=MOD;return x;}

lli n,m;
lli ans;
bool vis[10000010];
lli k = 1000000;

lli sum(lli x){
    if(x==0)
        return 0;
    x%=MOD;
    lli ret = x*(x+1);
    ret/=2;
    ret%=MOD;
    return ret;
}

lli sum(lli l,lli r){
    lli ret = sub(sum(r),sum(l-1));
    return ret;
}

void brute_force(){
    for(lli i=1;i<=m;i++)
        ans = add(ans,n%i);
    cout<<ans;
    exit(0);
}

int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    debug = 1;
#endif
    srand (time(NULL));

    lli magic = 10000000;
    slli(n);slli(m);
    if(m>=n){
        ans = (ans+((n%MOD)*((m-n)%MOD)))%MOD;
        m=n-1;
    }

    if(m<=10000000){
        brute_force();
    }

    for(lli i=n/m;;i++){
        lli low,high,mid,l=-1,r=-1;
        low = 1;high = m;
        while(low<=high){
            mid = (low + high)>>1;
            lli temp = n/mid;
            if(temp == i)
                l = mid;
            if(temp < i)
                high = mid - 1;
            else if(temp > i)
                low = mid + 1;
            else
                high = mid - 1;
        }
        low = 1;high = m;
        while(low<=high){
            mid = (low+high)>>1;
            lli temp = n/mid;
            if(temp == i)
                r = mid;
            if(temp < i)
                high = mid - 1;
            else if(temp > i)
                low = mid + 1;
            else
                low = mid + 1;
        }

        if(l==-1 || r==-1)
            continue;

        lli sz = r-l+1;
        lli temp1 = (n*sz)%MOD;
        lli temp2 = sum(l,r);
        temp2 = (temp2*i)%MOD;
        lli temp = sub(temp1,temp2);
        ans = add(ans,temp);

        if(l<=magic){
            for(lli j=l;j<=magic;j++)
                vis[j] = true;
            break;
        }
    }
    for(lli i=1;i<=magic;i++){
        if(vis[i])
            break;
        ans = add(ans,n%i);
    }
    cout<<ans;

    return 0;
}


/*
By : Yash Kumar
Dhirubhai Ambani Institute Of Information And Communication Technology, Gandhinagar (DA-IICT GANDHINAGAR)
*/
#include<bits/stdc++.h>

#define lli long long int
#define llu unsigned long long int
#define all(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define si(n) scanf("%d",&n)
#define slli(n) scanf("%lld",&n);
#define ss(n) scanf("%s",n);

const double EPS = 1e-10;
const lli MOD = 1000000007ll;
const lli mod1 = 1000000009ll;
const lli mod2 = 1100000009ll;
const double PI = 3.14159265359;
int INF = 2147483645;
lli INFINF = 9223372036854775807;
int debug = 0;

using namespace std;

lli bit_count(lli _x){lli _ret=0;while(_x){if(_x%2==1)_ret++;_x/=2;}return _ret;}
lli bit(lli _mask,lli _i){return (_mask&(1<<_i))==0?0:1;}
lli powermod(lli _a,lli _b,lli _m){lli _r=1;while(_b){if(_b%2==1)_r=(_r*_a)%_m;_b/=2;_a=(_a*_a)%_m;}return _r;}
lli add(lli a,lli b){lli x=a+b;while(x>=MOD)x-=MOD;return x;}
lli sub(lli a,lli b){lli x=a-b;while(x<0)x+=MOD;return x;}
lli mul(lli a,lli b){lli x=a*b;x%=MOD;return x;}

lli n,m;
lli ans;
bool vis[10000010];

lli sum(lli x){
    if(x==0)
        return 0;
    x%=MOD;
    lli ret = x*(x+1);
    ret/=2;
    ret%=MOD;
    return ret;
}

lli sum(lli l,lli r){
    lli ret = sub(sum(r),sum(l-1));
    return ret;
}

void brute_force(){
    for(lli i=1;i<=m;i++)
        ans = add(ans,n%i);
    cout<<ans;
    exit(0);
}

int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    debug = 1;
#endif
    srand (time(NULL));

    lli magic = 10000000;
    slli(n);slli(m);
    if(m>=n){
        ans = (ans+((n%MOD)*((m-n)%MOD)))%MOD;
        m=n-1;
    }

    if(m<=10000000){
        brute_force();
    }

    for(lli i=1;;i++){
        lli low,high,mid,l=-1,r=-1;

        low = 1;high = m;
        while(low<=high){
            mid = (low + high)>>1;
            lli temp = n/mid;
            if(temp == i)
                l = mid;
            if(temp < i)
                high = mid - 1;
            else if(temp > i)
                low = mid + 1;
            else
                high = mid - 1;
        }

        low = 1;high = m;
        while(low<=high){
            mid = (low+high)>>1;
            lli temp = n/mid;
            if(temp == i)
                r = mid;
            if(temp < i)
                high = mid - 1;
            else if(temp > i)
                low = mid + 1;
            else
                low = mid + 1;
        }

        if(l==-1 || r==-1)
            continue;

        lli sz = r-l+1;
        sz = sz%MOD;
        lli temp1 = ((n%MOD)*sz)%MOD;
        lli temp2 = sum(l,r);
        temp2 = (temp2*i)%MOD;
        lli temp = sub(temp1,temp2);
        ans = add(ans,temp);

        if(l<=magic){
            for(lli j=l;j<=magic;j++)
                vis[j] = true;
            break;
        }
    }
    for(lli i=1;i<=magic;i++){
        if(vis[i])
            break;
        ans = add(ans,n%i);
    }
    cout<<ans;

    return 0;
}


/*
By : Yash Kumar
Dhirubhai Ambani Institute Of Information And Communication Technology, Gandhinagar (DA-IICT GANDHINAGAR)
*/
#include<bits/stdc++.h>

#define lli long long int
#define llu unsigned long long int
#define all(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define si(n) scanf("%d",&n)
#define slli(n) scanf("%lld",&n);
#define ss(n) scanf("%s",n);

const double EPS = 1e-10;
const lli MOD = 1000000007ll;
const lli mod1 = 1000000009ll;
const lli mod2 = 1100000009ll;
const double PI = 3.14159265359;
int INF = 2147483645;
lli INFINF = 9223372036854775807;
int debug = 0;

using namespace std;

lli bit_count(lli _x){lli _ret=0;while(_x){if(_x%2==1)_ret++;_x/=2;}return _ret;}
lli bit(lli _mask,lli _i){return (_mask&(1<<_i))==0?0:1;}
lli powermod(lli _a,lli _b,lli _m){lli _r=1;while(_b){if(_b%2==1)_r=(_r*_a)%_m;_b/=2;_a=(_a*_a)%_m;}return _r;}
lli add(lli a,lli b){lli x=a+b;while(x>=MOD)x-=MOD;return x;}
lli sub(lli a,lli b){lli x=a-b;while(x<0)x+=MOD;return x;}
lli mul(lli a,lli b){lli x=a*b;x%=MOD;return x;}

lli n,m;
lli ans;
bool vis[10000010];
lli k = 1000000;

lli sum(lli x){
    if(x==0)
        return 0;
    x%=MOD;
    lli ret = x*(x+1);
    ret/=2;
    ret%=MOD;
    return ret;
}

lli sum(lli l,lli r){
    lli ret = sub(sum(r),sum(l-1));
    return ret;
}

void brute_force(){
    for(lli i=1;i<=m;i++)
        ans = add(ans,n%i);
    cout<<ans;
    exit(0);
}

int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    debug = 1;
#endif
    srand (time(NULL));

    lli magic = 10000000;
    slli(n);slli(m);
    if(m>=n){
        ans = (ans+((n%MOD)*((m-n)%MOD)))%MOD;
        m=n-1;
    }

    if(m<=10000000){
        brute_force();
    }

    for(lli i=n/m;;i++){
        lli low,high,mid,l=-1,r=-1;
        low = 1;high = m;
        while(low<=high){
            mid = (low + high)>>1;
            lli temp = n/mid;
            if(temp == i)
                l = mid;
            if(temp < i)
                high = mid - 1;
            else if(temp > i)
                low = mid + 1;
            else
                high = mid - 1;
        }
        low = 1;high = m;
        while(low<=high){
            mid = (low+high)>>1;
            lli temp = n/mid;
            if(temp == i)
                r = mid;
            if(temp < i)
                high = mid - 1;
            else if(temp > i)
                low = mid + 1;
            else
                low = mid + 1;
        }

        if(l==-1 || r==-1)
            continue;

        for(lli j=l;j<=magic;j++){
            if(vis[j])
                break;
            vis[j] = true;
        }

        lli sz = r-l+1;
        lli temp1 = (n*sz)%MOD;
        lli temp2 = sum(l,r);
        temp2 = (temp2*i)%MOD;
        lli temp = sub(temp1,temp2);
        ans = add(ans,temp);

        if(l<=magic)
            break;
    }
    for(lli i=1;i<=magic;i++){
        if(vis[i])
            break;
        ans = add(ans,n%i);
    }
    cout<<ans;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define re register
#define il inline
#define debug printf("PassLine:%d\n", __LINE__)
#define file(a) freopen(#a".in","r",stdin);freopen(#a".out","w",stdout)
#define maxn 1005
#define maxm 1005
#define inf 1234567890
#define int long long
#define mod 1000000007
il int read()
{
    re int x=0,f=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-') f=-1;c=getchar();}
    while(c>='0'&&c<='9') x=(x<<3)+(x<<1)+(c^48),c=getchar();
    return x*f;
}
int n,k,ans;
il int qpow(int a, int b) {
	int r = 1;
	while(b) {
		if(b & 1) r = (r * a) % mod;
		a = (a * a) % mod, b >>= 1;
	}
	return r;
}
signed main()
{
    k = read(), n = read();
    ans = (n % mod * k % mod) % mod;
 	for(re int i = 1, j; i <= n; i = j + 1)
    {
    	j = (k / i) == 0 ? n : min(k / (k / i), n);
        ans = (ans - ((k / i) % mod * (((j - i + 1) % mod * (i + j) % mod) % mod * qpow(2, mod - 2)) % mod) % mod) % mod;
    }
    printf("%lld", (ans + mod) % mod);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define re register
#define il inline
#define debug printf("PassLine:%d\n", __LINE__)
#define file(a) freopen(#a".in","r",stdin);freopen(#a".out","w",stdout)
#define maxn 1005
#define maxm 1005
#define inf 1234567890
#define int long long
#define mod 1000000007
il int read()
{
    re int x=0,f=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-') f=-1;c=getchar();}
    while(c>='0'&&c<='9') x=(x<<3)+(x<<1)+(c^48),c=getchar();
    return x*f;
}
int n,k,ans;
signed main()
{
    k = read(), n = read();
    ans = n * k;
 	for(re int i = 1, j; i <= n; i = j + 1)
    {
    	j = (k / i) == 0 ? n : min(k / (k / i), n);
        ans = (ans - ((k / i) * ((j - i + 1) * (i + j) / 2) % mod) % mod) % mod;
    }
    printf("%lld", (ans + mod) % mod);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define re register
#define il inline
#define debug printf("PassLine:%d\n", __LINE__)
#define file(a) freopen(#a".in","r",stdin);freopen(#a".out","w",stdout)
#define maxn 1005
#define maxm 1005
#define inf 1234567890
#define int long long
#define mod 1000000007
il int read()
{
    re int x=0,f=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-') f=-1;c=getchar();}
    while(c>='0'&&c<='9') x=(x<<3)+(x<<1)+(c^48),c=getchar();
    return x*f;
}
int n,k,ans, up;
signed main()
{
    k = read(), n = read();
    ans = (n % mod * k % mod) % mod, up = min(n, k);
 	for(re int i = 1, j; i <= up; i = j + 1)
    {
    	j = (k / i) == 0 ? up : min(k / (k / i), up);
    	int a = j - i + 1, b = i + j;
    	if(a & 1) b >>= 1;
    	else a >>= 1;
    	a %= mod, b %= mod;
        ans = (ans - (k / i) * ((a * b) % mod) % mod) % mod;
    }
    printf("%lld", (ans + mod) % mod);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define re register
#define il inline
#define debug printf("PassLine:%d\n", __LINE__)
#define file(a) freopen(#a".in","r",stdin);freopen(#a".out","w",stdout)
#define maxn 1000005
#define maxm 1000005
#define inf 1234567890
#define int long long
il int read()
{
    re int x=0,f=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-') f=-1;c=getchar();}
    while(c>='0'&&c<='9') x=(x<<3)+(x<<1)+(c^48),c=getchar();
    return x*f;
}
int n,k,ans;
signed main()
{
    n=read(),k=read();
    ans=n*k;
 	for(re int i=1,j;i<=n;i=j+1)
    {
        j=(k/i==0)?n:min(k/(k/i),n);
        ans-=(k/i)*((j-i+1)*(i+j))/2;
    }
    printf("%lld",ans);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define re register
#define il inline
#define debug printf("PassLine:%d\n", __LINE__)
#define file(a) freopen(#a".in","r",stdin);freopen(#a".out","w",stdout)
#define maxn 1005
#define maxm 1005
#define inf 1234567890
#define int long long
#define mod 1000000007
il int read()
{
    re int x=0,f=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-') f=-1;c=getchar();}
    while(c>='0'&&c<='9') x=(x<<3)+(x<<1)+(c^48),c=getchar();
    return x*f;
}
int n,k,ans;
signed main()
{
    k = read(), n = read();
    ans = (n % mod * k % mod) % mod;
 	for(re int i = 1, j; i <= n; i = j + 1)
    {
    	j = (k / i) == 0 ? n : min(k / (k / i), n);
    	int a = (j - i + 1), b = i + j;
    	if(a & 1) b >>= 1;
    	else a >>= 1;
    	a %= mod, b %= mod;
        ans = (ans - (k / i) * ((a * b) % mod) % mod) % mod;
    }
    printf("%lld", (ans + mod) % mod);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define re register
#define il inline
#define debug printf("PassLine:%d\n", __LINE__)
#define file(a) freopen(#a".in","r",stdin);freopen(#a".out","w",stdout)
#define maxn 1005
#define maxm 1005
#define inf 1234567890
#define int long long
#define mod 1000000007
il int read()
{
    re int x=0,f=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-') f=-1;c=getchar();}
    while(c>='0'&&c<='9') x=x*10+c-48,c=getchar();
    return x*f;
}
int n, k, ans, up, sum;
signed main()
{
    cin >> k >> n;
    ans = (n % mod) * (k % mod) % mod, up = min(n, k);
 	for(re int i = 1, j; i <= up; i = j + 1)
    {
    	j = min(k / (k / i), up);
    	int a = j - i + 1, b = i + j;
    	if(a & 1) b /= 2ll;
    	else a /= 2ll;
    	a %= mod, b %= mod;
        sum = (sum + ((k / i) % mod * ((a * b) % mod)) % mod) % mod;
    }
    printf("%lld", (ans - sum + mod) % mod);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define PB push_back
#define F first
#define S second
#define MP make_pair
#define endl '\n'

const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 90000000000000000;
#define MOD 1000000007
//#define harmonic(n) 0.57721566490153286l+log(n)

#define mem(a,b) memset(a, b, sizeof(a) )
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) ((a) * (a))

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef vector<int>::iterator vit;
typedef set<int>::iterator sit;

inline bool checkBit(ll n, int i) { return n&(1LL<<i); }
inline ll setBit(ll n, int i) { return n|(1LL<<i);; }
inline ll resetBit(ll n, int i) { return n&(~(1LL<<i)); }

int dx[] = {0, 0, +1, -1};
int dy[] = {+1, -1, 0, 0};
//int dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};
//int dy[] = {0, +1, 0, -1, +1, -1, +1, -1};

inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
inline bool isLeapYear(ll year) { return (year%400==0) || (year%4==0 && year%100!=0); }
inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }

//
//debug
#ifdef yamin
template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
            return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
            os << "{";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << it -> first << " = " << it -> second ;
                                            }
                    return os << "]";
}

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

void faltu () {
            cerr << endl;
}

template <typename T>
void faltu( T a[], int n ) {
            for(int i = 0; i < n; ++i) cerr << a[i] << ' ';
                cerr << endl;
}

template <typename T, typename ... hello>
void faltu( T arg, const hello &... rest) {
            cerr << arg << ' ';
                faltu(rest...);
}
#else
#define dbg(args...)
#endif // yamin

const ll modInverse = 500000004;

int main() {
    optimize();

    ll n, m;
    cin >> n >> m;

    ll ans = modMul(n, m);

    m = min(n, m);

    ll sqrtn = sqrt(n);

    ll lft = 0, rgt = 0;

    for(ll i = 1; i <= sqrtn && i <= m; ++i) {
            ans = modSub(ans, modMul(n/i, i));
            rgt = i;
    }

    for(ll i = n/(sqrtn+1); i > 0 && rgt < m; --i) {
            lft = (n/(i+1))+1, rgt = min(n/i, m);

            ll interval = rgt - lft + 1;

            ll sum = modMul(lft, interval);
            sum = modAdd(sum, modMul(modMul(interval, interval-1), modInverse));
            sum = modMul(sum, i);

            ans = modSub(ans, sum);
    }

    cout << ans;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define PB push_back
#define F first
#define S second
#define MP make_pair
#define endl '\n'

const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 90000000000000000;
#define MOD 1000000007
//#define harmonic(n) 0.57721566490153286l+log(n)

#define mem(a,b) memset(a, b, sizeof(a) )
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) ((a) * (a))

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef vector<int>::iterator vit;
typedef set<int>::iterator sit;

inline bool checkBit(ll n, int i) { return n&(1LL<<i); }
inline ll setBit(ll n, int i) { return n|(1LL<<i);; }
inline ll resetBit(ll n, int i) { return n&(~(1LL<<i)); }

int dx[] = {0, 0, +1, -1};
int dy[] = {+1, -1, 0, 0};
//int dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};
//int dy[] = {0, +1, 0, -1, +1, -1, +1, -1};

inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
inline bool isLeapYear(ll year) { return (year%400==0) || (year%4==0 && year%100!=0); }

//
//debug
#ifdef yamin
template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
            return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
            os << "{";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << it -> first << " = " << it -> second ;
                                            }
                    return os << "]";
}

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

void faltu () {
            cerr << endl;
}

template <typename T>
void faltu( T a[], int n ) {
            for(int i = 0; i < n; ++i) cerr << a[i] << ' ';
                cerr << endl;
}

template <typename T, typename ... hello>
void faltu( T arg, const hello &... rest) {
            cerr << arg << ' ';
                faltu(rest...);
}
#else
#define dbg(args...)
#endif // yamin

const ll modInverse = 500000004;

int main() {
    optimize();

    ll n, m;
    cin >> n >> m;

    ll ans = (n%MOD)*(m%MOD);
    ans %= MOD;
    dbg(ans);

    for(ll i = 1; i <= sqrt(n); ++i) {
            ans -= (((n/i)%MOD)*(i%MOD))%MOD;
            ans %= MOD;
            if(ans < 0) ans += MOD;
    }
    dbg(ans, sqrt(n));

    ll lft = 0, rgt = 0;

    for(ll i = n/(sqrt(n)+1); i > 0 && rgt < m; --i) {
            lft = n/(i+1) + 1;
            rgt = min(n/i, m);

            ll interval = (rgt-lft+1);

            ll sum = interval * lft; sum %= MOD;
            sum += (((interval%MOD)*((interval-1)%MOD)%MOD)*(modInverse))%MOD;
            //dbg(sum);
            sum = (sum%MOD)*(i%MOD);
            sum %= MOD;
            dbg(i, interval, lft, rgt, sum);
            ans -= sum;
            ans %= MOD;
            if(ans < 0) ans += MOD;
            //dbg(ans);
    }

    cout << ans;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define PB push_back
#define F first
#define S second
#define MP make_pair
#define endl '\n'

const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 90000000000000000;
#define MOD 1000000007
//#define harmonic(n) 0.57721566490153286l+log(n)

#define mem(a,b) memset(a, b, sizeof(a) )
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) ((a) * (a))

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef vector<int>::iterator vit;
typedef set<int>::iterator sit;

inline bool checkBit(ll n, int i) { return n&(1LL<<i); }
inline ll setBit(ll n, int i) { return n|(1LL<<i);; }
inline ll resetBit(ll n, int i) { return n&(~(1LL<<i)); }

int dx[] = {0, 0, +1, -1};
int dy[] = {+1, -1, 0, 0};
//int dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};
//int dy[] = {0, +1, 0, -1, +1, -1, +1, -1};

inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
inline bool isLeapYear(ll year) { return (year%400==0) || (year%4==0 && year%100!=0); }
inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }

//
//debug
#ifdef yamin
template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
            return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
            os << "{";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << it -> first << " = " << it -> second ;
                                            }
                    return os << "]";
}

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

void faltu () {
            cerr << endl;
}

template <typename T>
void faltu( T a[], int n ) {
            for(int i = 0; i < n; ++i) cerr << a[i] << ' ';
                cerr << endl;
}

template <typename T, typename ... hello>
void faltu( T arg, const hello &... rest) {
            cerr << arg << ' ';
                faltu(rest...);
}
#else
#define dbg(args...)
#endif // yamin

const ll modInverse = 500000004;

int main() {
    optimize();

    ll n, m;
    cin >> n >> m;

    ll ans = modMul(n, m);

    m = min(n, m);

    ll sqrtn = sqrt(n);

    ll lft = 0, rgt = 0;

    for(ll i = 1; i <= sqrtn && i <= m; ++i) {
            ans = modSub(ans, modMul(n/i, i));
            rgt = i;
    }

    for(ll i = n/(sqrtn+1); i > 0 && rgt < m; --i) {
            lft = (n/(i+1))+1, rgt = n/i;

            ll interval = rgt - lft + 1;

            ll sum = modMul(lft, interval);
            sum = modAdd(sum, modMul(modMul(interval, interval-1), modInverse));
            sum = modMul(sum, i);

            ans = modSub(ans, sum);
    }

    cout << ans;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define PB push_back
#define F first
#define S second
#define MP make_pair
#define endl '\n'

const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 90000000000000000;
#define MOD 1000000007
//#define harmonic(n) 0.57721566490153286l+log(n)

#define mem(a,b) memset(a, b, sizeof(a) )
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) ((a) * (a))

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef vector<int>::iterator vit;
typedef set<int>::iterator sit;

inline bool checkBit(ll n, int i) { return n&(1LL<<i); }
inline ll setBit(ll n, int i) { return n|(1LL<<i);; }
inline ll resetBit(ll n, int i) { return n&(~(1LL<<i)); }

int dx[] = {0, 0, +1, -1};
int dy[] = {+1, -1, 0, 0};
//int dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};
//int dy[] = {0, +1, 0, -1, +1, -1, +1, -1};

inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
inline bool isLeapYear(ll year) { return (year%400==0) || (year%4==0 && year%100!=0); }

//
//debug
#ifdef yamin
template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
            return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
            os << "{";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << it -> first << " = " << it -> second ;
                                            }
                    return os << "]";
}

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

void faltu () {
            cerr << endl;
}

template <typename T>
void faltu( T a[], int n ) {
            for(int i = 0; i < n; ++i) cerr << a[i] << ' ';
                cerr << endl;
}

template <typename T, typename ... hello>
void faltu( T arg, const hello &... rest) {
            cerr << arg << ' ';
                faltu(rest...);
}
#else
#define dbg(args...)
#endif // yamin

const ll modInverse = 500000004;

int main() {
    optimize();

    ll n, m;
    cin >> n >> m;

    ll ans = (n%MOD)*(m%MOD);
    ans %= MOD;
    dbg(ans);

    for(ll i = 1; i <= sqrt(n); ++i) {
            ans -= (((n/i)%MOD)*(i%MOD))%MOD;
            ans %= MOD;
            if(ans < 0) ans += MOD;
    }
    dbg(ans, sqrt(n));

    ll lft = 0, rgt = 0;

    for(ll i = n/(sqrt(n)+1); i > 0 && rgt < m; --i) {
            lft = n/(i+1) + 1;
            rgt = min(n/i, m);

            ll interval = (rgt-lft+1);
            dbg(i, interval, lft, rgt);

            ll sum = interval * lft; sum %= MOD;
            sum += (((interval%MOD)*((interval-1)%MOD)%MOD)*(modInverse))%MOD;
            dbg(sum);
            ans -= sum;
            ans %= MOD;
            if(ans < 0) ans += MOD;
    }

    cout << ans;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define PB push_back
#define F first
#define S second
#define MP make_pair
#define endl '\n'

const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 90000000000000000;
#define MOD 1000000007
//#define harmonic(n) 0.57721566490153286l+log(n)

#define mem(a,b) memset(a, b, sizeof(a) )
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) ((a) * (a))

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef vector<int>::iterator vit;
typedef set<int>::iterator sit;

inline bool checkBit(ll n, int i) { return n&(1LL<<i); }
inline ll setBit(ll n, int i) { return n|(1LL<<i);; }
inline ll resetBit(ll n, int i) { return n&(~(1LL<<i)); }

int dx[] = {0, 0, +1, -1};
int dy[] = {+1, -1, 0, 0};
//int dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};
//int dy[] = {0, +1, 0, -1, +1, -1, +1, -1};

inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
inline bool isLeapYear(ll year) { return (year%400==0) || (year%4==0 && year%100!=0); }
inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }

//
//debug
#ifdef yamin
template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
            return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
            os << "{";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << it -> first << " = " << it -> second ;
                                            }
                    return os << "]";
}

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

void faltu () {
            cerr << endl;
}

template <typename T>
void faltu( T a[], int n ) {
            for(int i = 0; i < n; ++i) cerr << a[i] << ' ';
                cerr << endl;
}

template <typename T, typename ... hello>
void faltu( T arg, const hello &... rest) {
            cerr << arg << ' ';
                faltu(rest...);
}
#else
#define dbg(args...)
#endif // yamin

const ll modInverse = 500000004;

int main() {
    optimize();

    ll n, m;
    cin >> n >> m;

    ll ans = (n%MOD)*(m%MOD);
    ans %= MOD;
    dbg(ans);

    ll sqrtn = sqrt(n);

    m = min(n, m);

    for(ll i = 1; i <= sqrtn && i <= m; ++i) {
            ans -= modMul(n/i, i);
            normal(ans);
    }

    ll lft = 0, rgt = 0;

    for(ll i = n/(sqrtn+1); i > 0 && rgt < m; --i) {
            lft = n/(i+1) + 1;
            rgt = min(n/i, m);

            ll interval = (rgt-lft+1);

            ll sum = interval * lft; sum %= MOD;
            sum += (((interval%MOD)*((interval-1)%MOD)%MOD)*(modInverse))%MOD;
            //dbg(sum);
            sum = modMul(sum, i);
            ans = modSub(ans, sum);
            normal(ans);
            //dbg(ans);
    }

    normal(ans);

    cout << ans;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define PB push_back
#define F first
#define S second
#define MP make_pair
#define endl '\n'

const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 90000000000000000;
#define MOD 1000000007
//#define harmonic(n) 0.57721566490153286l+log(n)

#define mem(a,b) memset(a, b, sizeof(a) )
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) ((a) * (a))

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef vector<int>::iterator vit;
typedef set<int>::iterator sit;

inline bool checkBit(ll n, int i) { return n&(1LL<<i); }
inline ll setBit(ll n, int i) { return n|(1LL<<i);; }
inline ll resetBit(ll n, int i) { return n&(~(1LL<<i)); }

int dx[] = {0, 0, +1, -1};
int dy[] = {+1, -1, 0, 0};
//int dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};
//int dy[] = {0, +1, 0, -1, +1, -1, +1, -1};

inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
inline bool isLeapYear(ll year) { return (year%400==0) || (year%4==0 && year%100!=0); }
inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }

//
//debug
#ifdef yamin
template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
            return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
            os << "{";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << it -> first << " = " << it -> second ;
                                            }
                    return os << "]";
}

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

void faltu () {
            cerr << endl;
}

template <typename T>
void faltu( T a[], int n ) {
            for(int i = 0; i < n; ++i) cerr << a[i] << ' ';
                cerr << endl;
}

template <typename T, typename ... hello>
void faltu( T arg, const hello &... rest) {
            cerr << arg << ' ';
                faltu(rest...);
}
#else
#define dbg(args...)
#endif // yamin

const ll modInverse = 500000004;

int main() {
    optimize();

    #ifdef yamin
    freopen("input.txt", "r", stdin);
    #endif // yamin

    ll n, m;
    cin >> n >> m;

    ll ans = modMul(n, m);
    dbg(ans);

    ll sqrtn = sqrt(n);

    m = min(n, m);

    ll rgt = 0, lft = 0;

    for(ll i = 1; i <= sqrtn && i <= m; ++i) {
            ans = modSub(ans, modMul(n/i, i));
            rgt = max(rgt, i);
    }

    for(ll i = n/(sqrtn+1); i > 0 && rgt < m; --i) {
            lft = n/(i+1) + 1;
            rgt = min(n/i, m);

            ll interval = (rgt-lft+1);

            ll sum = modMul(interval, lft);
            //sum += (((interval%MOD)*((interval-1)%MOD)%MOD)*(modInverse))%MOD;
            //dbg(sum);
            sum = modAdd(sum, modMul(modMul(interval, interval-1), modInverse));
            sum = modMul(sum, i);
            ans = modSub(ans, sum);
            //dbg(ans);
    }

    normal(ans);

    cout << ans;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define PB push_back
#define F first
#define S second
#define MP make_pair
#define endl '\n'

const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 90000000000000000;
#define MOD 1000000007
//#define harmonic(n) 0.57721566490153286l+log(n)

#define mem(a,b) memset(a, b, sizeof(a) )
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) ((a) * (a))

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef vector<int>::iterator vit;
typedef set<int>::iterator sit;

inline bool checkBit(ll n, int i) { return n&(1LL<<i); }
inline ll setBit(ll n, int i) { return n|(1LL<<i);; }
inline ll resetBit(ll n, int i) { return n&(~(1LL<<i)); }

int dx[] = {0, 0, +1, -1};
int dy[] = {+1, -1, 0, 0};
//int dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};
//int dy[] = {0, +1, 0, -1, +1, -1, +1, -1};

inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
inline bool isLeapYear(ll year) { return (year%400==0) || (year%4==0 && year%100!=0); }
inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }

//
//debug
#ifdef yamin
template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
            return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
            os << "{";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << it -> first << " = " << it -> second ;
                                            }
                    return os << "]";
}

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

void faltu () {
            cerr << endl;
}

template <typename T>
void faltu( T a[], int n ) {
            for(int i = 0; i < n; ++i) cerr << a[i] << ' ';
                cerr << endl;
}

template <typename T, typename ... hello>
void faltu( T arg, const hello &... rest) {
            cerr << arg << ' ';
                faltu(rest...);
}
#else
#define dbg(args...)
#endif // yamin

const ll modInverse = 500000004;

int main() {
    optimize();

    #ifdef yamin
    freopen("input.txt", "r", stdin);
    #endif // yamin

    ll n, m;
    cin >> n >> m;

    ll ans = modMul(n, m);
    dbg(ans);

    ll sqrtn = sqrt(n);

    m = min(n, m);

    for(ll i = 1; i <= sqrtn && i <= m; ++i) {
            ans -= modMul(n/i, i);
            normal(ans);
    }

    ll lft = 0, rgt = 0;

    for(ll i = n/(sqrtn+1); i > 0 && rgt < m; --i) {
            lft = n/(i+1) + 1;
            rgt = min(n/i, m);

            ll interval = (rgt-lft+1);

            ll sum = modMul(interval, lft);
            //sum += (((interval%MOD)*((interval-1)%MOD)%MOD)*(modInverse))%MOD;
            //dbg(sum);
            sum = modAdd(sum, modMul(modMul(interval, interval-1), modInverse));
            sum = modMul(sum, i);
            ans = modSub(ans, sum);
            normal(ans);
            //dbg(ans);
    }

    normal(ans);

    cout << ans;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define PB push_back
#define F first
#define S second
#define MP make_pair
#define endl '\n'

const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 90000000000000000;
#define MOD 1000000007
//#define harmonic(n) 0.57721566490153286l+log(n)

#define mem(a,b) memset(a, b, sizeof(a) )
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) ((a) * (a))

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef vector<int>::iterator vit;
typedef set<int>::iterator sit;

inline bool checkBit(ll n, int i) { return n&(1LL<<i); }
inline ll setBit(ll n, int i) { return n|(1LL<<i);; }
inline ll resetBit(ll n, int i) { return n&(~(1LL<<i)); }

int dx[] = {0, 0, +1, -1};
int dy[] = {+1, -1, 0, 0};
//int dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};
//int dy[] = {0, +1, 0, -1, +1, -1, +1, -1};

inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
inline bool isLeapYear(ll year) { return (year%400==0) || (year%4==0 && year%100!=0); }
inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }

//
//debug
#ifdef yamin
template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
            return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
            os << "{";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << it -> first << " = " << it -> second ;
                                            }
                    return os << "]";
}

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

void faltu () {
            cerr << endl;
}

template <typename T>
void faltu( T a[], int n ) {
            for(int i = 0; i < n; ++i) cerr << a[i] << ' ';
                cerr << endl;
}

template <typename T, typename ... hello>
void faltu( T arg, const hello &... rest) {
            cerr << arg << ' ';
                faltu(rest...);
}
#else
#define dbg(args...)
#endif // yamin

const ll modInverse = 500000004;

int main() {
    optimize();

    ll n, m;
    cin >> n >> m;

    ll ans = (n%MOD)*(m%MOD);
    ans %= MOD;
    dbg(ans);

    ll sqrtn = sqrt(n);

    for(ll i = 1; i <= sqrtn; ++i) {
            ans -= modMul(n/i, i);
            normal(ans);
    }

    ll lft = 0, rgt = 0;

    for(ll i = n/(sqrtn+1); i > 0 && rgt < m; --i) {
            lft = n/(i+1) + 1;
            rgt = min(n/i, m);

            ll interval = (rgt-lft+1);

            ll sum = interval * lft; sum %= MOD;
            sum += (((interval%MOD)*((interval-1)%MOD)%MOD)*(modInverse))%MOD;
            //dbg(sum);
            sum = modMul(sum, i);
            ans = modSub(ans, sum);
            normal(ans);
            //dbg(ans);
    }

    normal(ans);

    cout << ans;

    return 0;
}


// In the Name of Allah, the Most Gracious, the Most Merciful

// Solution By Doolatbek uulu Bektemir

#include <bits/stdc++.h>

using namespace std;

long long hhh, n, k;

int main()

{

    cin >> k >> n;

    if(n >= k)

    {
        hhh = k % MOD * ((n - k) % MOD) % MOD;
        n = k - 1;
    }

    for(long long L = 1; L <= n; L++) {
        long long t = k / L, R = t ? k / t : n;
        if(R > n) R = n;
        (hhh += (k % MOD) * ((R - L + 1) % MOD) % MOD - (t % MOD) * ((L + R) % MOD) % MOD * ((R - L + 1) % MOD) % MOD * 500000004 % MOD) %= MOD;
        L = R;
    }

    cout << (hhh % MOD + MOD) % MOD << "\n";

}


// In the Name of Allah, the Most Gracious, the Most Merciful

// Solution By Doolatbek uulu Bektemir

#include <bits/stdc++.h>

#define MOD 1000000007

using namespace std;

const double eps = 1e-10;
const double pi = acos(-1.0);

const int INF = 1e9+7;
const int N = 1e5+7;

int main()

{

    long long res = 0, n, k;

    cin >> k >> n;

    if(n >= k)

    {
        res = k % MOD * ((n - k) % MOD) % MOD;
        n = k - 1;
    }

    for(long long L = 1; L <= n; L++) {
        long long t = k / L, R = t ? k / t : n;
        if(R > n) R = n;
        (res += (k % MOD) * ((R - L + 1) % MOD) % MOD - (t % MOD) * ((L + R) % MOD) % MOD * ((R - L + 1) % MOD) % MOD * 500000004 % MOD) %= MOD;
        L = R;
    }

    cout << (res % MOD + MOD) % MOD << "\n";

}


// In the Name of Allah, the Most Gracious, the Most Merciful

// Solution By Doolatbek uulu Bektemir

#include <bits/stdc++.h>

#define MOD 1000000007

using namespace std;

const double eps = 1e-10;
const double pi = acos(-1.0);

const int INF = 1e9+7;
const int N = 1e5+7;

int main()

{

    long long ggg = 0, n, k;

    cin >> k >> n;

    if(n >= k)

    {
        ggg = k % MOD * ((n - k) % MOD) % MOD;
        n = k - 1;
    }

    for(long long L = 1; L <= n; L++) {
        long long t = k / L, R = t ? k / t : n;
        if(R > n) R = n;
        (ggg += (k % MOD) * ((R - L + 1) % MOD) % MOD - (t % MOD) * ((L + R) % MOD) % MOD * ((R - L + 1) % MOD) % MOD * 500000004 % MOD) %= MOD;
        L = R;
    }

    cout << (ggg % MOD + MOD) % MOD << "\n";

}


// In the Name of Allah, the Most Gracious, the Most Merciful

// Solution By Doolatbek uulu Bektemir

#include <bits/stdc++.h>

#define MOD 1000000007

using namespace std;

const double eps = 1e-10;
const double pi = acos(-1.0);

const int INF = 1e9+7;
const int N = 1e5+7;

long long ggg, n, k;

int main()

{

    cin >> k >> n;

    if(n >= k)

    {
        ggg = k % MOD * ((n - k) % MOD) % MOD;
        n = k - 1;
    }

    for(long long L = 1; L <= n; L++) {
        long long t = k / L, R = t ? k / t : n;
        if(R > n) R = n;
        (ggg += (k % MOD) * ((R - L + 1) % MOD) % MOD - (t % MOD) * ((L + R) % MOD) % MOD * ((R - L + 1) % MOD) % MOD * 500000004 % MOD) %= MOD;
        L = R;
    }

    cout << (ggg % MOD + MOD) % MOD << "\n";

    return 0;
}


// In the Name of Allah, the Most Gracious, the Most Merciful

// Solution By Doolatbek uulu Bektemir

#include <bits/stdc++.h>

#define MOD 1000000007

using namespace std;

const double eps = 1e-10;
const double pi = acos(-1.0);

const int INF = 1e9+7;
const int N = 1e5+7;

int main()

{

    long long ans = 0, n, k;

    cin >> k >> n;

    if(n >= k)

    {
        ans = k % MOD * ((n - k) % MOD) % MOD;
        n = k - 1;
    }

    for(long long L = 1; L <= n; L++) {
        long long t = k / L, R = t ? k / t : n;
        if(R > n) R = n;
        (ans += (k % MOD) * ((R - L + 1) % MOD) % MOD - (t % MOD) * ((L + R) % MOD) % MOD * ((R - L + 1) % MOD) % MOD * 500000004 % MOD) %= MOD;
        L = R;
    }

    cout << (ans % MOD + MOD) % MOD << "\n";

    return 0;
}


// In the Name of Allah, the Most Gracious, the Most Merciful

// Solution By Doolatbek uulu Bektemir

#include <bits/stdc++.h>

#define MOD 1000000007

using namespace std;

long long x, n, k;

int main()

{

    cin >> k >> n;

    if(n >= k)

    {
        x = k % MOD * ((n - k) % MOD) % MOD;
        n = k - 1;
    }

    for(long long L = 1; L <= n; L++) {
        long long t = k / L, R = t ? k / t : n;
        if(R > n) R = n;
        (x += (k % MOD) * ((R - L + 1) % MOD) % MOD - (t % MOD) * ((L + R) % MOD) % MOD * ((R - L + 1) % MOD) % MOD * 500000004 % MOD) %= MOD;
        L = R;
    }

    cout << (x % MOD + MOD) % MOD << "\n";

    return 0;
}


// In the Name of Allah, the Most Gracious, the Most Merciful

// Solution By Doolatbek uulu Bektemir

#include <bits/stdc++.h>

#define MOD 1000000007

using namespace std;

const double eps = 1e-10;
const double pi = acos(-1.0);

const int INF = 1e9+7;
const int N = 1e5+7;

int main()

{

    long long beko = 0, n, k;

    cin >> k >> n;

    if(n >= k)

    {
        beko = k % MOD * ((n - k) % MOD) % MOD;
        n = k - 1;
    }

    for(long long L = 1; L <= n; L++) {
        long long t = k / L, R = t ? k / t : n;
        if(R > n) R = n;
        (beko += (k % MOD) * ((R - L + 1) % MOD) % MOD - (t % MOD) * ((L + R) % MOD) % MOD * ((R - L + 1) % MOD) % MOD * 500000004 % MOD) %= MOD;
        L = R;
    }

    cout << (beko % MOD + MOD) % MOD << "\n";

}


// In the Name of Allah, the Most Gracious, the Most Merciful

// Solution By Doolatbek uulu Bektemir

#include <bits/stdc++.h>

using namespace std;

long long hhh, n, k;

int main()

{

    cin >> k >> n;

    if(n >= k)

    {
        hhh = k % MOD * ((n - k) % MOD) % MOD;
        n = k - 1;
    }

    for(long long L = 1; L <= n; L++) {
        long long t = k / L, R = t ? k / t : n;
        if(R > n) R = n;
        (hhh += (k % MOD) * ((R - L + 1) % MOD) % MOD - (t % MOD) * ((L + R) % MOD) % MOD * ((R - L + 1) % MOD) % MOD * 500000004 % MOD) %= MOD;
        L = R;
    }

    cout << (hhh % MOD + MOD) % MOD << "\n";

    return 0;
}


// In the Name of Allah, the Most Gracious, the Most Merciful

// Solution By Doolatbek uulu Bektemir

#include <bits/stdc++.h>

#define MOD 1000000007

using namespace std;

const double eps = 1e-10;
const double pi = acos(-1.0);

const int INF = 1e9+7;
const int N = 1e5+7;

int main()

{

    long long res = 0, n, k;

    cin >> k >> n;

    if(n >= k)

    {
        res = k % MOD * ((n - k) % MOD) % MOD;
        n = k - 1;
    }

    for(long long L = 1; L <= n; L++) {
        long long t = k / L, R = t ? k / t : n;
        if(R > n) R = n;
        (res += (k % MOD) * ((R - L + 1) % MOD) % MOD - (t % MOD) * ((L + R) % MOD) % MOD * ((R - L + 1) % MOD) % MOD * 500000004 % MOD) %= MOD;
        L = R;
    }

    cout << (res % MOD + MOD) % MOD << "\n";

    return 0;
}


// In the Name of Allah, the Most Gracious, the Most Merciful

// Solution By Doolatbek uulu Bektemir

#include <bits/stdc++.h>

#define MOD 1000000007

using namespace std;

const double eps = 1e-10;
const double pi = acos(-1.0);

const int INF = 1e9+7;
const int N = 1e5+7;

long long hhh, n, k;

int main()

{

    cin >> k >> n;

    if(n >= k)

    {
        hhh = k % MOD * ((n - k) % MOD) % MOD;
        n = k - 1;
    }

    for(long long L = 1; L <= n; L++) {
        long long t = k / L, R = t ? k / t : n;
        if(R > n) R = n;
        (hhh += (k % MOD) * ((R - L + 1) % MOD) % MOD - (t % MOD) * ((L + R) % MOD) % MOD * ((R - L + 1) % MOD) % MOD * 500000004 % MOD) %= MOD;
        L = R;
    }

    cout << (hhh % MOD + MOD) % MOD << "\n";

    return 0;
}


// In the Name of Allah, the Most Gracious, the Most Merciful

// Solution By Doolatbek uulu Bektemir

#include <bits/stdc++.h>

#define MOD 1000000007

using namespace std;

const double eps = 1e-10;
const double pi = acos(-1.0);

const int INF = 1e9+7;
const int N = 1e5+7;

int main()

{

    long long ggg = 0, n, k;

    cin >> k >> n;

    if(n >= k)

    {
        ggg = k % MOD * ((n - k) % MOD) % MOD;
        n = k - 1;
    }

    for(long long L = 1; L <= n; L++) {
        long long t = k / L, R = t ? k / t : n;
        if(R > n) R = n;
        (ggg += (k % MOD) * ((R - L + 1) % MOD) % MOD - (t % MOD) * ((L + R) % MOD) % MOD * ((R - L + 1) % MOD) % MOD * 500000004 % MOD) %= MOD;
        L = R;
    }

    cout << (ggg % MOD + MOD) % MOD << "\n";

    return 0;
}


// In the Name of Allah, the Most Gracious, the Most Merciful

// Solution By Doolatbek uulu Bektemir

#include <bits/stdc++.h>

#define MOD 1000000007

using namespace std;

const double eps = 1e-10;
const double pi = acos(-1.0);

const int INF = 1e9+7;
const int N = 1e5+7;

int main()

{

    long long beko = 0, n, k;

    cin >> k >> n;

    if(n >= k)

    {
        beko = k % MOD * ((n - k) % MOD) % MOD;
        n = k - 1;
    }

    for(long long L = 1; L <= n; L++) {
        long long t = k / L, R = t ? k / t : n;
        if(R > n) R = n;
        (beko += (k % MOD) * ((R - L + 1) % MOD) % MOD - (t % MOD) * ((L + R) % MOD) % MOD * ((R - L + 1) % MOD) % MOD * 500000004 % MOD) %= MOD;
        L = R;
    }

    cout << (beko % MOD + MOD) % MOD << "\n";

    return 0;
}


// In the Name of Allah, the Most Gracious, the Most Merciful

// Solution By Doolatbek uulu Bektemir

#include <bits/stdc++.h>

#define MOD 1000000007

using namespace std;

const double eps = 1e-10;
const double pi = acos(-1.0);

const int INF = 1e9+7;
const int N = 1e5+7;

long long hhh, n, k;

int main()

{

    cin >> k >> n;

    if(n >= k)

    {
        hhh = k % MOD * ((n - k) % MOD) % MOD;
        n = k - 1;
    }

    for(long long L = 1; L <= n; L++) {
        long long t = k / L, R = t ? k / t : n;
        if(R > n) R = n;
        (hhh += (k % MOD) * ((R - L + 1) % MOD) % MOD - (t % MOD) * ((L + R) % MOD) % MOD * ((R - L + 1) % MOD) % MOD * 500000004 % MOD) %= MOD;
        L = R;
    }

    cout << (hhh % MOD + MOD) % MOD << "\n";

}


#define md 1000000007
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define IALL
#define INTEGERONLY
#ifdef IALL
  #define int long long
#endif
namespace Template {
  #define FOR(i, x, y) for(int i = (x); i <= (y); ++i)
  #define FORD(i, x, y) for(int i = (x); i >= (y); --i)
  #define MASK(i) (1LL << (i))
  #define COUNT(x) __builtin_popcountll(x)
  #define BIT(x, i) (((x) >> (i)) & 1)
  #define pb push_back
  #define eb emplace_back
  #define Size(v) (int)v.size()
  typedef long long ll;
  typedef long double ld;
  typedef vector<int> vi;
  typedef vector<long long> vll;
  typedef vector<pair<int, int>> vii;
  typedef pair<int, int> ii;
  template <typename T>
  using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
  const double pi = acos(-1);
  struct Point {
    ll x, y;
    Point(): x{0}, y{0} {}
    Point(ll a, ll b): x{a}, y{b} {}
    bool operator<(const Point& other) const {
      return make_pair(x, y) < make_pair(other.x, other.y);
    }
    Point operator-(const Point& other) const {
      return Point(x - other.x, y - other.y);
    }
    ll operator*(const Point& other) const {
      return (x * other.y - y * other.x);
    }
    ll operator%(const Point& other) const {
      return (x * other.x + y * other.y);
    }
    double len() {
      return sqrt((double)x * x + y * y);
    }
  };
  double angle(const Point & a, const Point & b, const Point & c) {return atan2((a - b) * (c - b), (a - b) % (c - b));}
  double dist(const Point & a, const Point & b) {return (b - a).len();}
  ll area2(const Point & a, const Point & b, const Point & c) {return abs((b - a) * (c - a));}
  bool obtuse(const Point & a, const Point & b, const Point & c) {return abs(angle(a, b, c)) > pi / 2;}
  ll eval(Point a, Point b, Point c) {return (b - a) * (c - b);}
  bool cw(Point a, Point b, Point c) {return eval(a, b, c) < 0;}
  bool ccw(Point a, Point b, Point c) {return eval(a, b, c) > 0;}
  void convex_hull(vector<Point> & a) {
    if (Size(a) == 1) return;
    sort(a.begin(), a.end());
    Point p1 = a[0], p2 = a.back();
    vector<Point> up, down;
    up.push_back(p1);
    down.push_back(p1);
    for (int i = 1; i < Size(a); ++i) {
      if (i == Size(a) - 1 || cw(p1, a[i], p2)) {
        while (Size(up) >= 2 && !cw(up[Size(up) - 2], up[Size(up) - 1], a[i])) {
          up.pop_back();
        }
        up.push_back(a[i]);
      }
      if (i == Size(a) - 1 || ccw(p1, a[i], p2)) {
        while (Size(down) >= 2 && !ccw(down[Size(down) - 2], down[Size(down) - 1], a[i])) {
          down.pop_back();
        }
        down.push_back(a[i]);
      }
    }
    a.clear();
    // convex hull in clockwise order
    for (int i = 0; i < Size(up); ++i) a.pb(up[i]);
    for (int i = Size(down) - 2; i > 0; --i) a.pb(down[i]);
  }
  double area(vector<Point> & temp) {
    int n = Size(temp);
    double res = 0;
    for (int i = 0; i < n - 1; ++i) {
      // actually, this represent the vector with root (0, 0) to point temp
      res += temp[i] * temp[i + 1];
    }
    res += temp[n - 1] * temp[0];
    return abs(res) / 2.0;
  }
  ll raw_dist(const Point& a, const Point& b) {
    return (b.x-a.x)*(b.x-a.x)+(b.y-a.y)*(b.y-a.y);
  }
  template <typename T>
  T inverse(T a, T m) {
    T u = 0, v = 1;
    while (a != 0) {
      T t = m / a;
      m -= t * a; swap(a, m);
      u -= t * v; swap(u, v);
    }
    assert(m == 1);
    return u;
  }
  mt19937 mt_rng(chrono::steady_clock::now().time_since_epoch().count());
  ll randint(ll a, ll b) {
    return uniform_int_distribution<ll>(a, b)(mt_rng);
  }
  template <typename T>
  class Modular {
   public:
    using Type = typename decay<decltype(T::value)>::type;
    constexpr Modular() : value() {}
    template <typename U>
    Modular(const U& x) {
      value = normalize(x);
    }
    template <typename U>
    static Type normalize(const U& x) {
      Type v;
      if (-mod() <= x && x < mod()) v = static_cast<Type>(x);
      else v = static_cast<Type>(x % mod());
      if (v < 0) v += mod();
      return v;
    }
    const Type& operator()() const { return value; }
    template <typename U>
    explicit operator U() const { return static_cast<U>(value); }
    constexpr static Type mod() { return T::value; }
    Modular& operator+=(const Modular& other) { if ((value += other.value) >= mod()) value -= mod(); return *this; }
    Modular& operator-=(const Modular& other) { if ((value -= other.value) < 0) value += mod(); return *this; }
    template <typename U> Modular& operator+=(const U& other) { return *this += Modular(other); }
    template <typename U> Modular& operator-=(const U& other) { return *this -= Modular(other); }
    Modular& operator++() { return *this += 1; }
    Modular& operator--() { return *this -= 1; }
    #ifdef IALL
      #undef int
    #endif
    Modular operator++(int) { Modular result(*this); *this += 1; return result; }
    Modular operator--(int) { Modular result(*this); *this -= 1; return result; }
    Modular operator-() const { return Modular(-value); }
    template <typename U = T>
    typename enable_if<is_same<typename Modular<U>::Type, int>::value, Modular>::type& operator*=(const Modular& rhs) {
    #ifdef IALL
      #define int long long
    #endif
  #ifdef _WIN32
      uint64_t x = static_cast<int64_t>(value) * static_cast<int64_t>(rhs.value);
      uint32_t xh = static_cast<uint32_t>(x >> 32), xl = static_cast<uint32_t>(x), d, m;
      asm(
        "divl %4; \n\t"
        : "=a" (d), "=d" (m)
        : "d" (xh), "a" (xl), "r" (mod())
      );
      value = m;
  #else
      value = normalize(static_cast<int64_t>(value) * static_cast<int64_t>(rhs.value));
  #endif
      return *this;
    }
    #ifdef IALL
      #define int long long
    #endif
    template <typename U = T>
    typename enable_if<is_same<typename Modular<U>::Type, ll>::value, Modular>::type& operator*=(const Modular& rhs) {
      ll q = static_cast<ll>(static_cast<ld>(value) * rhs.value / mod());
      value = normalize(value * rhs.value - q * mod());
      return *this;
    }
    template <typename U = T>
    typename enable_if<!is_integral<typename Modular<U>::Type>::value, Modular>::type& operator*=(const Modular& rhs) {
      value = normalize(value * rhs.value);
      return *this;
    }
    Modular& operator/=(const Modular& other) { return *this *= Modular(inverse(other.value, mod())); }
    friend const Type& abs(const Modular& x) { return x.value; }
    template <typename U>
    friend bool operator==(const Modular<U>& lhs, const Modular<U>& rhs);
    template <typename U>
    friend bool operator<(const Modular<U>& lhs, const Modular<U>& rhs);
    template <typename V, typename U>
    friend V& operator>>(V& stream, Modular<U>& number);
   private:
    Type value;
  };
  template <typename T> bool operator==(const Modular<T>& lhs, const Modular<T>& rhs) { return lhs.value == rhs.value; }
  template <typename T, typename U> bool operator==(const Modular<T>& lhs, U rhs) { return lhs == Modular<T>(rhs); }
  template <typename T, typename U> bool operator==(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) == rhs; }
  template <typename T> bool operator!=(const Modular<T>& lhs, const Modular<T>& rhs) { return !(lhs == rhs); }
  template <typename T, typename U> bool operator!=(const Modular<T>& lhs, U rhs) { return !(lhs == rhs); }
  template <typename T, typename U> bool operator!=(U lhs, const Modular<T>& rhs) { return !(lhs == rhs); }
  template <typename T> bool operator<(const Modular<T>& lhs, const Modular<T>& rhs) { return lhs.value < rhs.value; }
  template <typename T> Modular<T> operator+(const Modular<T>& lhs, const Modular<T>& rhs) { return Modular<T>(lhs) += rhs; }
  template <typename T, typename U> Modular<T> operator+(const Modular<T>& lhs, U rhs) { return Modular<T>(lhs) += rhs; }
  template <typename T, typename U> Modular<T> operator+(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) += rhs; }
  template <typename T> Modular<T> operator-(const Modular<T>& lhs, const Modular<T>& rhs) { return Modular<T>(lhs) -= rhs; }
  template <typename T, typename U> Modular<T> operator-(const Modular<T>& lhs, U rhs) { return Modular<T>(lhs) -= rhs; }
  template <typename T, typename U> Modular<T> operator-(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) -= rhs; }
  template <typename T> Modular<T> operator*(const Modular<T>& lhs, const Modular<T>& rhs) { return Modular<T>(lhs) *= rhs; }
  template <typename T, typename U> Modular<T> operator*(const Modular<T>& lhs, U rhs) { return Modular<T>(lhs) *= rhs; }
  template <typename T, typename U> Modular<T> operator*(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) *= rhs; }
  template <typename T> Modular<T> operator/(const Modular<T>& lhs, const Modular<T>& rhs) { return Modular<T>(lhs) /= rhs; }
  template <typename T, typename U> Modular<T> operator/(const Modular<T>& lhs, U rhs) { return Modular<T>(lhs) /= rhs; }
  template <typename T, typename U> Modular<T> operator/(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) /= rhs; }
  template<typename T, typename U>
  Modular<T> power(const Modular<T>& a, const U& b) {
    assert(b >= 0);
    Modular<T> x = a, res = 1;
    U p = b;
    while (p > 0) {
      if (p & 1) res *= x;
      x *= x;
      p >>= 1;
    }
    return res;
  }
  template <typename T>
  bool IsZero(const Modular<T>& number) {
    return number() == 0;
  }
  template <typename T>
  string to_string(const Modular<T>& number) {
    return to_string(number());
  }
  template <typename U, typename T>
  U& operator<<(U& stream, const Modular<T>& number) {
    return stream << number();
  }
  template <typename U, typename T>
  U& operator>>(U& stream, Modular<T>& number) {
    typename common_type<typename Modular<T>::Type, ll>::type x;
    stream >> x;
    number.value = Modular<T>::normalize(x);
    return stream;
  }
  using Mint = Modular<std::integral_constant<decay<decltype(md)>::type, md>>;
  inline void set_precision(const int& x) {cout << fixed << setprecision(x);}
  #ifdef INTEGERONLY
    inline void read(Mint & x) {char c;bool nega=0;while((!isdigit(c=getchar()))&&(c!='-'));if(c=='-'){nega=1;c=getchar();}x=c-48;while(isdigit(c=getchar())) x=x*10+c-48;if(nega) x=-x;}
    inline void writep(const Mint & _x){int x=(int)_x;if(x>9) writep(x/10);putchar(x%10+48);}
    inline void write(const Mint & _x) {int x=(int)_x;if(x<0){putchar('-');x=-x;}writep(x);putchar(' ');}
    inline void writeln(const Mint & x) {write(x);putchar('\n');}
    inline void sysout(const Mint & x) {cout << x;}
    template <typename T> inline void read(T &x){char c;bool nega=0;while((!isdigit(c=getchar()))&&(c!='-'));if(c=='-'){nega=1;c=getchar();}x=c-48;while(isdigit(c=getchar())) x=(x<<3)+(x<<1)+c-48;if(nega) x=-x;}
    template <typename T> inline void writep(const T & x){if(x>9) writep(x/10);putchar(x%10+48);}
    template <typename T> inline void write(T x){if(x<0){putchar('-');x=-x;}writep(x);putchar(' ');}
    template <typename T> inline void writeln(const T & x){write(x);putchar('\n');}
    template<class H, class... T> inline void read(H& h, T&... t) {
      read(h);
      read(t...);
    }
    template<class H, class... T> inline void write(const H& h, const T&... t) {
      write(h);
      write(t...);
    }
    template<class H, class... T> inline void writeln(const H& h, const T&... t) {
      write(h);
      write(t...);
      putchar('\n');
    }
  #endif
  #ifndef INTEGERONLY
    template<typename T> inline void read(T& x) {cin >> x;}
    template<typename T> inline void write(const T& x) {cout << x << ' ';}
    template<typename T> inline void writeln(const T& x) {cout << x << '\n';}
    template<typename H, typename... T> inline void read(H& h, T&... t) {
      read(h);
      read(t...);
  }
  template<typename H, typename... T> inline void write(const H& h, const T&... t) {
    write(h);
    write(t...);
  }
  template<typename H, typename... T> inline void writeln(const H& h, const T&... t) {
    write(h);
    write(t...);
    cout << '\n';
  }
  #endif
  template <typename T>
  __attribute__((always_inline)) void chmax(T& a, const T& b) {a=a<b?b:a;}
  template<typename T>
  __attribute__((always_inline)) void chmin(T& a, const T& b) {a=a<b?a:b;}
  void debug_out() {cerr << endl;}
  template <typename Head, typename... Tail>
  void debug_out(Head H, Tail... T) {
    cerr << " " << std::to_string(H);
    debug_out(T...);
  }
  #define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
}
using namespace Template;

struct Segment {
	ll l, r, val;
	Segment(): l{0}, r{0}, val{0} {}
	Segment(ll a, ll b, ll c): l{a}, r{b}, val{c} {}
};

vector<Segment> segs;

ll n, m;

inline void decompose_into_segments(ll i) {
	ll k = 1;
	while (k <= i) {
		ll first = k;
		ll q = i / k;
		ll second = i / q;
		k = second + 1;
		segs.eb(first, second, q);
	}
}

Mint get(int l, int r) {
	return Mint(l + r) * (r - l + 1) / 2;
}

int32_t main() {
    #define filename ""
    if (fopen(filename".INP", "r")) {
        freopen(filename".INP", "r", stdin);
        freopen(filename".OUT", "w", stdout);
    }
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    read(n, m);
    decompose_into_segments(n);

    // n*n - [n/1]*1 -[n/2]*2 - ...
    Mint cur = Mint(n)*n;
    bool quit = false;

    for (auto &p : segs) {
    	int l = p.l, r = p.r, val = p.val;
    	if (r >= m) {
    		r = m;
    		quit = true;
    	}
    	cur -= Mint(val) * get(l, r);
    	if (quit) break;
    }

    if (n < m) {
    	cur += Mint(n) * (m - n);
    }

    write(cur);

    return 0;
}


#define md 1000000007
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define INTEGERONLY
#ifdef IALL
  #define int long long
#endif
namespace Template {
  #define FOR(i, x, y) for(int i = (x); i <= (y); ++i)
  #define FORD(i, x, y) for(int i = (x); i >= (y); --i)
  #define MASK(i) (1LL << (i))
  #define COUNT(x) __builtin_popcountll(x)
  #define BIT(x, i) (((x) >> (i)) & 1)
  #define pb push_back
  #define eb emplace_back
  #define Size(v) (int)v.size()
  typedef long long ll;
  typedef long double ld;
  typedef vector<int> vi;
  typedef vector<long long> vll;
  typedef vector<pair<int, int>> vii;
  typedef pair<int, int> ii;
  template <typename T>
  using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
  const double pi = acos(-1);
  struct Point {
    ll x, y;
    Point(): x{0}, y{0} {}
    Point(ll a, ll b): x{a}, y{b} {}
    bool operator<(const Point& other) const {
      return make_pair(x, y) < make_pair(other.x, other.y);
    }
    Point operator-(const Point& other) const {
      return Point(x - other.x, y - other.y);
    }
    ll operator*(const Point& other) const {
      return (x * other.y - y * other.x);
    }
    ll operator%(const Point& other) const {
      return (x * other.x + y * other.y);
    }
    double len() {
      return sqrt((double)x * x + y * y);
    }
  };
  double angle(const Point & a, const Point & b, const Point & c) {return atan2((a - b) * (c - b), (a - b) % (c - b));}
  double dist(const Point & a, const Point & b) {return (b - a).len();}
  ll area2(const Point & a, const Point & b, const Point & c) {return abs((b - a) * (c - a));}
  bool obtuse(const Point & a, const Point & b, const Point & c) {return abs(angle(a, b, c)) > pi / 2;}
  ll eval(Point a, Point b, Point c) {return (b - a) * (c - b);}
  bool cw(Point a, Point b, Point c) {return eval(a, b, c) < 0;}
  bool ccw(Point a, Point b, Point c) {return eval(a, b, c) > 0;}
  void convex_hull(vector<Point> & a) {
    if (Size(a) == 1) return;
    sort(a.begin(), a.end());
    Point p1 = a[0], p2 = a.back();
    vector<Point> up, down;
    up.push_back(p1);
    down.push_back(p1);
    for (int i = 1; i < Size(a); ++i) {
      if (i == Size(a) - 1 || cw(p1, a[i], p2)) {
        while (Size(up) >= 2 && !cw(up[Size(up) - 2], up[Size(up) - 1], a[i])) {
          up.pop_back();
        }
        up.push_back(a[i]);
      }
      if (i == Size(a) - 1 || ccw(p1, a[i], p2)) {
        while (Size(down) >= 2 && !ccw(down[Size(down) - 2], down[Size(down) - 1], a[i])) {
          down.pop_back();
        }
        down.push_back(a[i]);
      }
    }
    a.clear();
    // convex hull in clockwise order
    for (int i = 0; i < Size(up); ++i) a.pb(up[i]);
    for (int i = Size(down) - 2; i > 0; --i) a.pb(down[i]);
  }
  double area(vector<Point> & temp) {
    int n = Size(temp);
    double res = 0;
    for (int i = 0; i < n - 1; ++i) {
      // actually, this represent the vector with root (0, 0) to point temp
      res += temp[i] * temp[i + 1];
    }
    res += temp[n - 1] * temp[0];
    return abs(res) / 2.0;
  }
  ll raw_dist(const Point& a, const Point& b) {
    return (b.x-a.x)*(b.x-a.x)+(b.y-a.y)*(b.y-a.y);
  }
  template <typename T>
  T inverse(T a, T m) {
    T u = 0, v = 1;
    while (a != 0) {
      T t = m / a;
      m -= t * a; swap(a, m);
      u -= t * v; swap(u, v);
    }
    assert(m == 1);
    return u;
  }
  mt19937 mt_rng(chrono::steady_clock::now().time_since_epoch().count());
  ll randint(ll a, ll b) {
    return uniform_int_distribution<ll>(a, b)(mt_rng);
  }
  template <typename T>
  class Modular {
   public:
    using Type = typename decay<decltype(T::value)>::type;
    constexpr Modular() : value() {}
    template <typename U>
    Modular(const U& x) {
      value = normalize(x);
    }
    template <typename U>
    static Type normalize(const U& x) {
      Type v;
      if (-mod() <= x && x < mod()) v = static_cast<Type>(x);
      else v = static_cast<Type>(x % mod());
      if (v < 0) v += mod();
      return v;
    }
    const Type& operator()() const { return value; }
    template <typename U>
    explicit operator U() const { return static_cast<U>(value); }
    constexpr static Type mod() { return T::value; }
    Modular& operator+=(const Modular& other) { if ((value += other.value) >= mod()) value -= mod(); return *this; }
    Modular& operator-=(const Modular& other) { if ((value -= other.value) < 0) value += mod(); return *this; }
    template <typename U> Modular& operator+=(const U& other) { return *this += Modular(other); }
    template <typename U> Modular& operator-=(const U& other) { return *this -= Modular(other); }
    Modular& operator++() { return *this += 1; }
    Modular& operator--() { return *this -= 1; }
    #ifdef IALL
      #undef int
    #endif
    Modular operator++(int) { Modular result(*this); *this += 1; return result; }
    Modular operator--(int) { Modular result(*this); *this -= 1; return result; }
    Modular operator-() const { return Modular(-value); }
    template <typename U = T>
    typename enable_if<is_same<typename Modular<U>::Type, int>::value, Modular>::type& operator*=(const Modular& rhs) {
    #ifdef IALL
      #define int long long
    #endif
  #ifdef _WIN32
      uint64_t x = static_cast<int64_t>(value) * static_cast<int64_t>(rhs.value);
      uint32_t xh = static_cast<uint32_t>(x >> 32), xl = static_cast<uint32_t>(x), d, m;
      asm(
        "divl %4; \n\t"
        : "=a" (d), "=d" (m)
        : "d" (xh), "a" (xl), "r" (mod())
      );
      value = m;
  #else
      value = normalize(static_cast<int64_t>(value) * static_cast<int64_t>(rhs.value));
  #endif
      return *this;
    }
    #ifdef IALL
      #define int long long
    #endif
    template <typename U = T>
    typename enable_if<is_same<typename Modular<U>::Type, ll>::value, Modular>::type& operator*=(const Modular& rhs) {
      ll q = static_cast<ll>(static_cast<ld>(value) * rhs.value / mod());
      value = normalize(value * rhs.value - q * mod());
      return *this;
    }
    template <typename U = T>
    typename enable_if<!is_integral<typename Modular<U>::Type>::value, Modular>::type& operator*=(const Modular& rhs) {
      value = normalize(value * rhs.value);
      return *this;
    }
    Modular& operator/=(const Modular& other) { return *this *= Modular(inverse(other.value, mod())); }
    friend const Type& abs(const Modular& x) { return x.value; }
    template <typename U>
    friend bool operator==(const Modular<U>& lhs, const Modular<U>& rhs);
    template <typename U>
    friend bool operator<(const Modular<U>& lhs, const Modular<U>& rhs);
    template <typename V, typename U>
    friend V& operator>>(V& stream, Modular<U>& number);
   private:
    Type value;
  };
  template <typename T> bool operator==(const Modular<T>& lhs, const Modular<T>& rhs) { return lhs.value == rhs.value; }
  template <typename T, typename U> bool operator==(const Modular<T>& lhs, U rhs) { return lhs == Modular<T>(rhs); }
  template <typename T, typename U> bool operator==(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) == rhs; }
  template <typename T> bool operator!=(const Modular<T>& lhs, const Modular<T>& rhs) { return !(lhs == rhs); }
  template <typename T, typename U> bool operator!=(const Modular<T>& lhs, U rhs) { return !(lhs == rhs); }
  template <typename T, typename U> bool operator!=(U lhs, const Modular<T>& rhs) { return !(lhs == rhs); }
  template <typename T> bool operator<(const Modular<T>& lhs, const Modular<T>& rhs) { return lhs.value < rhs.value; }
  template <typename T> Modular<T> operator+(const Modular<T>& lhs, const Modular<T>& rhs) { return Modular<T>(lhs) += rhs; }
  template <typename T, typename U> Modular<T> operator+(const Modular<T>& lhs, U rhs) { return Modular<T>(lhs) += rhs; }
  template <typename T, typename U> Modular<T> operator+(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) += rhs; }
  template <typename T> Modular<T> operator-(const Modular<T>& lhs, const Modular<T>& rhs) { return Modular<T>(lhs) -= rhs; }
  template <typename T, typename U> Modular<T> operator-(const Modular<T>& lhs, U rhs) { return Modular<T>(lhs) -= rhs; }
  template <typename T, typename U> Modular<T> operator-(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) -= rhs; }
  template <typename T> Modular<T> operator*(const Modular<T>& lhs, const Modular<T>& rhs) { return Modular<T>(lhs) *= rhs; }
  template <typename T, typename U> Modular<T> operator*(const Modular<T>& lhs, U rhs) { return Modular<T>(lhs) *= rhs; }
  template <typename T, typename U> Modular<T> operator*(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) *= rhs; }
  template <typename T> Modular<T> operator/(const Modular<T>& lhs, const Modular<T>& rhs) { return Modular<T>(lhs) /= rhs; }
  template <typename T, typename U> Modular<T> operator/(const Modular<T>& lhs, U rhs) { return Modular<T>(lhs) /= rhs; }
  template <typename T, typename U> Modular<T> operator/(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) /= rhs; }
  template<typename T, typename U>
  Modular<T> power(const Modular<T>& a, const U& b) {
    assert(b >= 0);
    Modular<T> x = a, res = 1;
    U p = b;
    while (p > 0) {
      if (p & 1) res *= x;
      x *= x;
      p >>= 1;
    }
    return res;
  }
  template <typename T>
  bool IsZero(const Modular<T>& number) {
    return number() == 0;
  }
  template <typename T>
  string to_string(const Modular<T>& number) {
    return to_string(number());
  }
  template <typename U, typename T>
  U& operator<<(U& stream, const Modular<T>& number) {
    return stream << number();
  }
  template <typename U, typename T>
  U& operator>>(U& stream, Modular<T>& number) {
    typename common_type<typename Modular<T>::Type, ll>::type x;
    stream >> x;
    number.value = Modular<T>::normalize(x);
    return stream;
  }
  using Mint = Modular<std::integral_constant<decay<decltype(md)>::type, md>>;
  inline void set_precision(const int& x) {cout << fixed << setprecision(x);}
  #ifdef INTEGERONLY
    inline void read(Mint & x) {char c;bool nega=0;while((!isdigit(c=getchar()))&&(c!='-'));if(c=='-'){nega=1;c=getchar();}x=c-48;while(isdigit(c=getchar())) x=x*10+c-48;if(nega) x=-x;}
    inline void writep(const Mint & _x){int x=(int)_x;if(x>9) writep(x/10);putchar(x%10+48);}
    inline void write(const Mint & _x) {int x=(int)_x;if(x<0){putchar('-');x=-x;}writep(x);putchar(' ');}
    inline void writeln(const Mint & x) {write(x);putchar('\n');}
    inline void sysout(const Mint & x) {cout << x;}
    template <typename T> inline void read(T &x){char c;bool nega=0;while((!isdigit(c=getchar()))&&(c!='-'));if(c=='-'){nega=1;c=getchar();}x=c-48;while(isdigit(c=getchar())) x=(x<<3)+(x<<1)+c-48;if(nega) x=-x;}
    template <typename T> inline void writep(const T & x){if(x>9) writep(x/10);putchar(x%10+48);}
    template <typename T> inline void write(T x){if(x<0){putchar('-');x=-x;}writep(x);putchar(' ');}
    template <typename T> inline void writeln(const T & x){write(x);putchar('\n');}
    template<class H, class... T> inline void read(H& h, T&... t) {
      read(h);
      read(t...);
    }
    template<class H, class... T> inline void write(const H& h, const T&... t) {
      write(h);
      write(t...);
    }
    template<class H, class... T> inline void writeln(const H& h, const T&... t) {
      write(h);
      write(t...);
      putchar('\n');
    }
  #endif
  #ifndef INTEGERONLY
    template<typename T> inline void read(T& x) {cin >> x;}
    template<typename T> inline void write(const T& x) {cout << x << ' ';}
    template<typename T> inline void writeln(const T& x) {cout << x << '\n';}
    template<typename H, typename... T> inline void read(H& h, T&... t) {
      read(h);
      read(t...);
  }
  template<typename H, typename... T> inline void write(const H& h, const T&... t) {
    write(h);
    write(t...);
  }
  template<typename H, typename... T> inline void writeln(const H& h, const T&... t) {
    write(h);
    write(t...);
    cout << '\n';
  }
  #endif
  template <typename T>
  __attribute__((always_inline)) void chmax(T& a, const T& b) {a=a<b?b:a;}
  template<typename T>
  __attribute__((always_inline)) void chmin(T& a, const T& b) {a=a<b?a:b;}
  void debug_out() {cerr << endl;}
  template <typename Head, typename... Tail>
  void debug_out(Head H, Tail... T) {
    cerr << " " << std::to_string(H);
    debug_out(T...);
  }
  #define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
}
using namespace Template;

ll n, m;
Mint cur;
bool quit = false;

Mint get(ll l, ll r) {
	return Mint(l + r) * (r - l + 1) / 2;
}

inline void solve(ll l, ll r) {
	if (quit) return;
	if (r >= m) {
		r = m;
		quit = true;
	}
	ll val = n / l;
	cur -= Mint(val) * get(l, r);
}

inline void decompose_into_segments(ll i) {
	ll k = 1;
	while (k <= i) {
		if (quit) return;
		ll first = k;
		ll q = i / k;
		ll second = i / q;
		k = second + 1;
		solve(first, second);
	}
}

int32_t main() {
    #define filename ""
    if (fopen(filename".INP", "r")) {
        freopen(filename".INP", "r", stdin);
        freopen(filename".OUT", "w", stdout);
    }
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    read(n, m);
    // n*min(n,m) - [n/1]*1 -[n/2]*2 - ...
    cur = Mint(n)*min(n, m);
    decompose_into_segments(n);
    if (n < m) cur += Mint(n) * (m - n);

    write(cur);

    return 0;
}