#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+5,mod=1e9+7;
ll n,k,ans[N];
ll qpow(ll a,ll n)
{
    ll ans=1;
    while(n)
    {
        if(n&1) ans=ans*a%mod;
        a=a*a%mod;
        n>>=1;
    }
    return ans;
}
int main()
{
    scanf("%lld%lld",&n,&k);
    ll res=0;
    for(int i=k;i>=1;i--)
    {
        ans[i]=(ans[i]+qpow(k/i,n))%mod;
        res=(res+ans[i]*i)%mod;
        for(int j=1;j*j<=i;j++)
            if(i%j==0)
            {
                if(j!=i)
                    ans[j]=(ans[j]-ans[i])%mod;
                if(i/j!=j&&i/j!=i)
                    ans[i/j]=(ans[i/j]-ans[i])%mod;
            }
    }
    res=(res+mod)%mod;
    printf("%lld\n",res);
}
