#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <functional>
#include <climits>
#include <cstring>

using namespace std;

#define int long long
#define rep(i, n) for (int i=0;i<(int)n;++i)
#define rep1(i, n) for (int i=1;i<=(int)n;++i)
#define unless(a) if(!(a))
#define all(a) begin(a),end(a)
#define fst first
#define scd second
#define PB emplace_back
#define PPB pop_back

using ll=long long;
using vi=vector<int>;
using pii=pair<int, int>;

constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
bool chmin(int&a,int b){return a>b?(a=b,true):false;}
bool chmax(int&a,int b){return a<b?(a=b,true):false;}
ll read(){ll a;scanf("%lld",&a);return a;}

const int inf = 3 * TEN(18) + 10;
const int mod = TEN(9) + 7;

inline ll mod_pow(ll a, ll x, ll m)
{
	if (x == 0) return 1ll;

	ll res = mod_pow(a, x / 2, m);

	res *= res;
	res %= m;

	if (x % 2) {
		res *= a;
		res %= m;
	}

	return res;
}

int N, K;
int counter[100010];

signed main()
{
	cin >> N >> K;

	int ans = 0;

	for (int i = K; i >= 1; --i) {
		counter[i] = mod_pow(K / i, N, mod);
		for (int j = i + i; j <= K; j += i) {
			counter[i] += mod - counter[j];
			counter[i] %= mod;
		}
	}

	for (int i = 1; i <= K; ++i) {
		ans += i * counter[i];
		ans %= mod;
	}

	cout << ans << endl;
}


