#include<bits/stdc++.h>

using namespace std;

typedef long long int ll;
#define f first
#define s second
#define Mp make_pair
#define pb push_back
#define ppb pop_back
#define Lb lower_bound
#define Ub upper_bound
#define all(x) x.begin(), x.end()
#define fast_io ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
const ll Maxn = 1e5+5, N = 1e6+5, Mod = 1e9+7, Inf = 1e18, Log = 22;
ll Power(ll x, ll t){
    if (t == 0){
        return 1;
    }
    return ((t%2 ? x : 1)*Power((x*x)% Mod, t/2))%Mod;
}
ll n, k, dp[Maxn], ans;
int main(){
    fast_io
    cin >> n >> k;
    for (ll i = k; 1 <= i; i--){
        dp[i] = (Power(k/i, n))%Mod;
        for (ll j = 2*i; j <= k; j += i){
            dp[i] -= dp[j];
            dp[i] += Mod;
            dp[i] %= Mod;
        }
        ans += (dp[i]*i)%Mod;
        ans %= Mod;
    }
    cout << ans << '\n';
    return 0;
}
