#include <bits/stdc++.h>
using namespace std;
#define rep(i,n); for(long long i = 0;i < (n);i++)
using ll = long long;
using vl = vector<long long>;
using P = pair<long long,long long>;
const int mod = 1000000007;

ll ruijo(ll x, ll n){
	if(n == 0)return 1;
    if(n%2 == 0)return ruijo(x*x%mod ,n/2)%mod;
	return x * ruijo(x*x%mod ,n/2)%mod;
}

int main(){
	ll n,k; cin >> n >> k;
	vl ans(k);
	for(ll i = k-1;i>=0;i--){
		ans[i] = ruijo(k/(i+1),n);
		for(ll j = 2*i+1;j<k;j += (i+1)){
			ans[i] -= ans[j];
		}
	}
	ll sum = 0;
	rep(i,k){
		sum += ans[i]*(i+1);
		sum %= mod;
	}
	if(sum < 0)sum += mod;
	cout << sum << endl;
} 