#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<cmath>
#include<deque>
#include<map>

using namespace std;
typedef long long ll;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define INF 1LL << 60
#define MAX 1000000000
const int MOD = 1000000007;
int gcd(int p, int q) { return p % q ? gcd(q, p % q) : q; }
long long modpow(long long a, long long n) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % MOD;
		a = a * a % MOD;
		n >>= 1;
	}
	return res;
}
ll dp[100001], s;
int main() {
	int N, K;
	scanf("%d%d", &N, &K);
	rep(l, 1, K + 1) {
		dp[l] += l;
		for (int m = l * 2; m <= K; m += l) {
			dp[m] -= dp[l];
		}
		s += modpow(K / l, N) * dp[l];
		s %= MOD;
	}
	printf("%lld\n", s);
	return 0;
}