#include<bits/stdc++.h>

using namespace std;

using ll = long long;
constexpr int mo = 1e9+7;
constexpr int inf = 1<<30;
constexpr ll infl = 1ll<<60;
constexpr ll mo2 = 998244353;

ll mpow(ll a,ll n){
    ll ret = 1;
    while(n){
        if(n&1)(ret *= a)%= mo;
        (a *= a)%=mo;
        n>>=1;
    }
    return ret%mo;
}
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    vector<ll> dp(100005);
    int n,k;
    cin>>n>>k;
    ll ret = 0;
    for(int i=k;i>0;--i){
        dp[i] = mpow(k/i,n);
        for(int j=2*i;j<=k;j+=i)dp[i] -= dp[j];
        dp[i] = (dp[i]%mo+mo)%mo;
        ret += i*dp[i]%mo;
    }
    cout << ret%mo << endl;
    return 0;
}