#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rept(i,k,n) for(int i = (k); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())
#define mod 1000000007
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<long long,long long> Pll;

template <typename T>
void vecprint(vector<T> &vec) {
    cout<<'[';
    for(T x:vec){
        cout<<x<<',';
    }
    cout<<']'<<endl;
    return;
}

ll powm(ll a,ll b){
    if(b==1) return a;
    if(b%2) return powm(a*a%mod,b/2)*a%mod;
    else return powm(a*a%mod,b/2)%mod;
}

int main() {
    ll n,k;
    cin>>n>>k;
    vector<ll> cnt(k+1,0);
    for(ll i=k;i>0;i--){
        ll tmp = powm(k/i,n);
        for(ll j=i*2;j<=k;j+=i){
            tmp=(tmp+mod-cnt[j])%mod;
        }
        cnt[i]=tmp;
    }
    ll ans=0;
    rept(i,1,k+1){
        ans+=cnt[i]*i;
        ans%=mod;
    }
    cout<<ans<<endl;
    return 0;
}
