#include <bits/stdc++.h>

using namespace std;
const int N=1e5+10;
const int MOD=1e9+7;
typedef long long ll;
ll qpow(ll a,ll b){
    ll ans=1;
    while(b){
        if(b%2){
            ans=ans*a%MOD;
        }
        b/=2;
        a=a*a%MOD;
    }
    return ans;
}
ll f[N];
int main()
{
    //cout<<qpow(2,4);
    ll n,k;
    cin >>n>>k;
    ll ans=0;
    for(int i=k;i>=1;i--){
            f[i]=qpow(k/i,n);
        for(int j=i*2;j<=k;j+=i){
            f[i]=(f[i]-f[j])%MOD;
        }
        ans=(ans+i*f[i])%MOD;
    }
    cout<<ans<<endl;
}
