#include <stdio.h>

#define mod 1000000007
#define ll long long


ll n,k;
ll ans[100010];


ll quickpow(ll a,ll b){ 
        ll ans = 1;
        while(b != 0){ 
                if(b%2 == 1){ 
                        ans = (ans%mod*a%mod)%mod;
                }   
                b = b/2;
                a = (a%mod*a%mod)%mod;
        }   
        return ans;
}


int main(void){

        scanf("%lld %lld",&n,&k);
        for(ll i=k;i>=1;i--){
                ans[i] = quickpow(k/i,n);

                for(ll j=(ll)2*i;j<=k;j+=i){
                        ans[i] = (ans[i]-ans[j]+mod)%mod;
                }   
        }   

        ll res = 0;
        for(ll i=1;i<=k;i++){
                res = (res+i*ans[i])%mod;
        }   
        printf("%lld\n",res);
return 0;
}

