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

long long modpow(long long a,long long n,long long p = 1e9+7){
    long long result = 1;
    while(n > 0){
        if(n & 1) (result *= a) %= p;
        (a*=a) %= p;
        n >>= 1;
    }
    return result;
}
#define ll long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define rel(i,x,y) for(ll i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()
ll mod = 1e9+7;
ll dp[100010]; //kで割れる個数
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n,k; cin >> n >> k;
    ll ans=0;
    rel(i,k+1,1){
        dp[i] = modpow(k/i,n);
        for(ll j=2*i;j<=k;j+=i){
            dp[i] -= dp[j];
            if(dp[i]<0) dp[i] += mod;
        }
        ans = (ans+(dp[i] * i)%mod)%mod;
    }
    cout << ans << endl;
}