#include <bits/stdc++.h>
using namespace std;
typedef int ll;
const ll N=2e5+5,mod=1e9+7;
ll power(ll n,ll p){
    ll ans=1;
    while(p){
        if(p&1)ans*=n,ans%=mod;
        p>>=1;
        n*=n;
        n%=mod;
    }
    return ans;
}
ll sum[N],ans;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,k;cin>>n>>k;
    for(ll i=k;i>=1;i--){
        ll cnt=k/i;
        sum[i] = power(cnt,n);
        for(ll j=2*i;j<=k;j+=i)sum[i]=sum[i]-sum[j]+mod,sum[i]%=mod;
        ans+=(sum[i]*i)%mod;
        ans%=mod;
    }
    cout<<ans;
}
