#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define inf 1000000000000000
#define bpc(x) __builtin_parityll(x)
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 

using namespace std;

ll powa(ll a, ll b, ll c)
{
    a%=c;
    if(a<0)
	a+=c;
    ll res = 1;
    while(b>0)
    {
        if(b&1)
            res*=a, res%=c;
        a*=a, a%=c;
        b>>=1;
    }
    return res;
}
 
#define N 200005
 
ll fact[N];
ll ifact[N];
 
ll ncr(ll n, ll r)
{
    if(r>n)
        return 0;
    ll ans = fact[n];
    ans*=ifact[r];
    ans%=mod;
    ans*=ifact[n-r];
    ans%=mod;
    return ans;
}

int main()
{
   FAST/**/
   
   fact[0] = 1;
   for(ll i=1;i<N;i++)
        fact[i] = fact[i-1]*i, fact[i]%=mod;
   for(ll i=0;i<N;i++)
        ifact[i] = powa(fact[i],mod-2,mod);
   
   ll n,k;
   cin>>n>>k;
   
   ll hold[k+1];
   memset(hold,0,sizeof(hold));
   for(ll i=1;i<=k;i++)
        hold[i] = k/i;
   ll dp[k+1];
   memset(dp,0,sizeof(dp));
   for(ll i=k;i>0;i--)
   {
        dp[i] = powa(hold[i],n,mod);
        for(ll j = 2*i;j<=k;j+=i)
            dp[i] = (dp[i]+mod-dp[j])%mod;
   }
   
   ll ans = 0;
   for(ll i=1;i<=k;i++)
   {
       ans+=(i*dp[i])%mod;
       ans%=mod;
   }
   cout<<ans;
   
   return 0;        
}  
   