#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll                long long int
#define ld                long double
#define pb                push_back
#define mk                make_pair
#define vi                vector<ll>
#define vii               vector<pair<ll,ll>>
#define vpp               vector<pair<ll,pair<ll,ll>>>
#define vll               vector<ll>
#define vc                vector<char>
#define vs                vector<string>
#define mll               map<ll,ll>
#define mci               map<char,ll>
#define msi               map<string,ll>
#define in(i,a,n)         for(ll i=0;i<n;++i) cin>>a[i];
#define out(i,a,n)        for(ll i=0;i<n;++i) cout<<a[i]<<" ";
#define sz(c)             (ll)c.size()
#define len(c)            (ll)c.length()
#define hell              (ll)1000000007
#define all(c)            c.begin(), c.end()
#define rall(c)           c.rbegin(), c.rend()
#define trav(a,i)         for(auto& i: a)
#define loop(i,a,b)       for(ll i=a;i<b;i++)
#define rloop(i,a,b)      for(ll i=a;i>b;i--)
#define invect(v,n)       for(ll i=0;i<n;i++ ){ll arb;cin>>arb;v.pb(arb);}
#define inset(s,n)        forloop(n){ll aset;cin>>aset;s.insert(aset);}
#define F                 first
#define S                 second
#define pii               pair<ll,ll>
#define PB                pop_back
#define copy(a,b)         copy(all(a),back_inserter(b));
#define section(a,b,w)    set_intersection(a.begin(), a.end(),b.begin(), b.end(),back_inserter(w));
#define union(a,b,w)      set_union(a.begin(), a.end(),b.begin(), b.end(),back_inserter(w));
#define diff(a,b,w)       set_difference(a.begin(), a.end(),b.begin(), b.end(),back_inserter(w));
#define symdiff(a,b,w)    set_symmetric_difference(a.begin(), a.end(),b.begin(), b.end(),back_inserter(w));
#define sp(n)             setprecision(n)
#define fin               freopen( "input.txt", "r", stdin );
#define fout              freopen( "output.txt", "w", stdout );
#define outall(a)         loop(i,0,sizeof(a)/sizeof(a[0])) cout<<a[i]<<" "; cout<<endl
#define endl "\n"
const ll N=300001;
const ll MOD = 1000 * 1000 * 1000 + 7;
ll mod(ll n) {
    return (n % MOD + MOD) % MOD;
}

//vector<ll> v;
 ll powm(ll a,ll b, ll m){
    if(b==0) return 1;
    ll t=powm(a,b/2,m);
    if(b%2) return a*t%m*t%m;
    return t*t%m;
 }
 
/*ll binpow(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}*/
 
/*int bs(int a[],int low, int high, int val)
{
    int mid=(low+high)/2;
    if(low>high) return -1;
    if(a[mid]>val) bs(a,low,mid-1,val);
    else if(a[mid]<val) bs(a,mid+1,high,val);
    else return mid;
}*/

void solve(){
    ll n,l,k,i,j,sum=0,count=0,ans=0,min_value=INT_MIN;
    cin>>n>>k;
    ll dp[k+1]={0};
    rloop(i,k,0){   
        ll total_multiples=(k/i);
        ll total_sequences=powm(total_multiples,n,MOD)%MOD;
        dp[i]=total_sequences;
        ll extra=0;
        for(j=2*i;j<=k;j+=i){
            extra+=(dp[j]+MOD)%MOD;
        }
        dp[i]-=extra;
    }
    loop(i,1,k+1){
        sum+=((dp[i]%MOD)*(i%MOD)+MOD)%MOD;
    }
    cout<<sum%MOD<<"\n";
}

signed main(){
    //fin fout
    fast
    ll t=1; //cin>>t;
    while(t--) solve();
}

Measured memory_bytes: 4372