#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<vector>
#include<map>
using namespace std;
const int mod = 1e9+7;

int read(){
	int x=0,f=1;
	char c=getchar();
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c)){x=(x<<3)+(x<<1)+c-48;c=getchar();}
	return x*f;
}

int fpm(int x,int y){
	int summ=1;
	while(y){
		if(y&1)summ=1ll*summ*x%mod;
		x=1ll*x*x%mod;
		y>>=1;
	}
	return summ;
}

int k,m,n,sum[1000010];
int main(){
	n=read();k=read();
	long long ans=0;
	for(register int i=k;i>=1;i--){
		sum[i]=fpm(k/i,n);
		for(register int j=i*2;j<=k;j+=i)
			(sum[i]=sum[i]-sum[j]+mod)%=mod;
		(ans+=1ll*sum[i]*i%mod)%=mod;
	}
	printf("%lld\n",ans);
	return 0;
}