#include "bits/stdc++.h"
#define FI first.first
#define SE first.second
#define TH second
#define fi first
#define se second
#define th second

using namespace std;

class DebugStream {}LOG;
template <typename T>DebugStream &operator<<(DebugStream &s, const T&) { return s; }
#ifdef DEBUG
#define LOG clog
#endif

typedef long long ll;
typedef pair<ll, ll> ii;
typedef long double ld;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

const int maxN = 1e5 + 9, maxV = 1e6 + 9, MOD = 1e9 + 7, SQ = 335, lg = 20, bs = 29;

ll fastPow(ll a, ll b) {
	ll ret = 1;
	while(b) {
		if(b & 1) ret = ret * a % MOD;
		b >>= 1, a = a * a % MOD;
	}
	return ret;
}

ll ans[maxN];

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	#ifdef DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif

	ll n, k;
	cin >> n >> k;

	ll sm = 0;
	for(int i = k; i > 0; i--) {
		ans[i] = fastPow(k / i, n);
		for(int j = i * 2; j <= k; j += i)
			ans[i] = (ans[i] + MOD - ans[j]) % MOD;
		sm = (sm + ans[i] * i) % MOD;
	}
	cout << sm << '\n';
}
