#include<bits/stdc++.h>
using namespace std;
#define MN 200005
#define LL long long
#define mp make_pair
#define fir first
#define sec second
#define pii pair<int,int>
inline void chkmax(int &a,int b){if(a<b)a=b;}
inline void chkmin(int &a,int b){if(a>b)a=b;}
inline int read(){
	   int a=0,fh=1;char c=getchar();
	   while(c>'9'||c<'0'){if(c=='-')fh=-1;c=getchar();}
	   while('0'<=c&&c<='9'){
		   a=a*10+c-48;
		   c=getchar();
	   }
	   return a*fh;
}
#define Mod 1000000007
LL ksm(int a,int x){
	LL ans=1,w=a;
	while(x){
		if(x&1)ans=ans*w%Mod;
		x>>=1;
		w=w*w%Mod;
	}
	return ans;
}
int n,k;
LL f[MN],ans;
int main(){
	n=read();k=read();
	for(int i=k;i;--i){
		f[i]=ksm(k/i,n);
		for(int j=i*2;j<=k;j+=i)
			f[i]=(f[i]-f[j]+Mod)%Mod;
		ans+=(LL)f[i]*i%Mod;
	}
	printf("%lld\n",ans%Mod);
	return 0;
}















