#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
ll dp[100005];
ll qpow(ll a,ll b)
{
	if(b==0) return 1;
	ll c=qpow(a,b/2);
	if(b%2==0) return c*c%mod;
	else return c*c%mod*a%mod;
}
int main()
{
	ll n,k;
	scanf("%lld%lld",&n,&k);
	ll sum=0;
	for(ll i=k;i>0;i--)
	{
		dp[i]=(qpow(k/i,n))%mod;
		for(ll j=i*2;j<=k;j+=i) dp[i]=(dp[i]-dp[j]+mod)%mod;
		sum=(sum+dp[i]*i)%mod;
	}
	printf("%lld",sum);
}