#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<string.h>
#define ll long long
using namespace std;
const int maxn=1e5;
const ll mod=1e9+7;
bool check[maxn+10];
int prime[maxn+10];
int mu[maxn+10];
ll sum[maxn+10];
int n,k;
void mo()
{
    memset(check,0,sizeof(check));
    mu[1]=1;
    int tot=0;
    for(int i=2;i<=maxn;i++)
    {
        if(!check[i]){prime[tot++]=i;mu[i]=-1;}
        for(int j=0;j<tot;j++)
        {
            if(i*prime[j]>maxn) break;
            check[i*prime[j]]=1;
            if(i%prime[j]==0)
            {
                mu[i*prime[j]]=0;break;
            }
            else
                mu[i*prime[j]]=-mu[i];
        }
    }
    for(int i=1;i<=maxn;i++)
        sum[i]=(sum[i-1]+mu[i])%mod;
}
ll fpow(ll a,ll b)
{
    ll ans=1;
    while(b)
    {
        if(b&1) ans=ans*a%mod;
        a=a*a%mod;
        b>>=1;
    }
    return ans;
}
int main()
{
    scanf("%d%d",&n,&k);
    mo();
    ll ans=0;
    for(int i=1;i<=k;i++)
    {
        ll res=0;
        for(int j=1;j<=k/i;j++)
            res=(res+mu[j]*fpow(k/i/j,n)%mod)%mod;
        ans=(ans+res*i%mod)%mod;
    }
    printf("%lld\n",ans);
}
