#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
ll mod=1e9+7;
long long pwr(long long x, long long e){
    if(e==0)
        return 1;
    long long tmp=pwr(x,e/2);
    tmp=(tmp*tmp)%mod;
    if(e%2)
        tmp=(tmp*x)%mod;
    return tmp;
}
ll dp[100010];
int main(){
    ll n, k;
    while(cin>>n>>k){
        ll ans=0;
        for(ll i=k; i>=1; --i){
        	dp[i]=pwr(k/i, n);
        	for(int j=i+i; j<=k; j+=i){
        		dp[i]-=dp[j];
        	}
        	ans+=i*dp[i];
        	ans%=mod;
        }
        if(ans<0){
        	ans+=mod;
        }
        printf("%lld\n",ans);
    }
  return 0;
}


