#include<bits/stdc++.h>

using namespace std;
typedef long long int ll;

const int MAXN = 100 * 1000 + 10;
const ll md = 1e9 + 7;
ll k, n, dp[MAXN], ans = 0;

ll pw(ll a, ll b)
{
	if(b == (ll)0)
		return (ll)1;
	if(b % 2 == 0)
		return ((pw(a, b / 2)) * (pw(a, b / 2))) % md;
	return ((((pw(a, b / 2)) * (pw(a, b / 2))) % md) * a) % md;
}

int main()
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n >> k;
	for(ll x = k; x >= 1; x--)
	{
		cout << "x " << x << endl;
		dp[x] = pw((k / x), n);
		for(ll y = 2 * x; y <= k; y += x)
		{
			dp[x] -= dp[y];
			dp[x] %= md;
		}
	}
	for(ll x = 1; x <= k; x++)
	{
		ll y = x * dp[x];
		y %= md;
		ans += y;
		ans %= md;
	}
	cout << ans << endl;
	return 0; 
}
