#include<stdio.h>
#define m 1000000007
#define LL long long int

LL modpow(LL a, LL b, LL mod){
	LL ret = 1;
	for(a %= mod; b; a = a * a % mod, b = b>>1){
		if(b&1) ret = ret * a % mod;
	}
	return ret;
}

int main(){
	int N, K;
	scanf("%d %d", &N, &K);
	LL a[K + 1];
	int b, i, x;
	LL ret = 0;
	for(x = K; x >= 1; x--){
		b = 1;
		b = modpow(K/x, N, m);
		a[x] = b;
		for(i = 2; i <= K/x; i++){
			a[x] = a[x] - a[i*x];
		}
		//printf("%lld\n", a[x]);
	}
	for(i = 1; i <= K; i++){
		ret = ret + (a[i]%m) * (i %m);
		ret = ret%m;
	}
	printf("%lld\n", ret);
	return 0;
}