#include <bits/stdc++.h>
#define ull unsigned long long
#define ll long long
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define line cout<<"----------------------------"<<endl;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
#define filein freopen("input.txt","r",stdin)
#define fileout freopen("output.txt","w",stdout)
using namespace std;
const ll  mx=100009;
ll  sum[mx];
ll  bigmod(ll  a,ll  b, ll  m)
{
    ll  ans=1;
    a%=m;
    while(b)
    {
        if(b&1) ans=(ans*a)%m;
        b>>=1; ; a=(a*a)%m;
    }
    return ans;
}
int  main()
{
    ll  n,k;
    cin>>n>>k;
    for(ll  i=1;i<=k;i++)
    {
        sum[i]=bigmod(k/i,n,mod);
    }
    for(ll  i=k;i>=1;i--)
    {
        for(int j=i*2;j<=k;j+=i)
        {
            sum[i]-=sum[j];
            sum[i]=(sum[i]+mod)%mod;
        }
    }
    ll  ans=0;
    for(ll  i=1;i<=k;i++)
    {
        ans+=(sum[i]*i)%mod;
        ans%=mod;
    }
    cout<<ans<<endl;

}
