#include <bits/stdc++.h>
using namespace std;
						
#define fast_cin() ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define endl '\n'
#define int long long

const int N = 1e5, mod = 1e9 + 7;

int cnt[N + 1];

int binpow(int x, int y) {
    int res = 1LL;
    x %= mod;
    while (y) {
        if (y & 1) res = (res * x) % mod;
        y >>= 1;
        x = (x * x) % mod;
    }
    return res;
}

int mod_inv(int x) {
    return binpow(x, mod - 2);
}
				
int32_t main() {
	fast_cin();  
	int n, k;
	cin >> n >> k;
	for (int gd = k; gd >= 1; gd--) {
		int total = binpow(k / gd, n);
		int less = 0;
		for (int j = 2 * gd; j <= k; j += gd) {
			less +=  cnt[j];
			less %= mod;
		}
		cnt[gd] = total - less;
		cnt[gd] += mod;
		cnt[gd] %= mod;
	}
	int ans = 0;
	for (int gd = 1; gd <= k; gd++) {
		ans += gd * cnt[gd];
		ans %= mod;
	}
	cout << ans << endl;
	return 0;
}