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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
typedef long long ll;

ll MOD = 1000000007;

ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while(n > 0) {
        if(n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main() {
    int N,K; cin >> N >> K;

    vector<ll> d(K);
    rep1(i,K+1) d[i] = modpow(K/i,N,MOD);

    for(int i = K; i > 0; i--) {
        for(int j = 2*i; j <= K; j += i) {
            d[i] -= d[j];
            d[i] %= MOD;
        }
    }

    ll ans = 0;
    rep1(i,K+1) {
        ans = (ans + (d[i] * i) % MOD) % MOD;
    }
    cout << ans << endl;
}