#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define Rep(i,m,n) for(int i=(m);i<(n);i++)
#define debug(a,b) cout << "debug : " << a << " , "<< b << endl
using ll=long long;
const ll INF=1LL<<60;
const ll mod=1E9+7;

ll power(ll a,ll b,ll mod){
  if(b==0)return 1;
  ll u=power(a,b/2,mod);
  u=(u*u)%mod;
  if(b%2)u=(a*u)%mod;
  return u;
}


int main(){
  ll n,k;
  cin >> n >> k;
  vector<ll>pcs(k+1,0);
  Rep(i,1,k+1)pcs[i]=power(k/i,n,mod);
  
  for(int i=k;i>=1;i--){
    for(int j=2*i;j<=k;j+=i){
      pcs[i]=(pcs[i]-pcs[j]+mod)%mod;
    }
  }
  ll ans=0;
  rep(i,k+1){
    ans+=(pcs[i]*(ll)i)%mod;
    ans%=mod;
  }
  cout << ans;

  return 0;

}





