#include <bits/stdc++.h>
using namespace std;
using ll= long long ;
using P = pair<ll,ll>;
#define rep(i,n) for (ll i = 0; i<(ll)(n); i++)
#define mod 1000000007

ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    if(b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a, ll b){
    ll g=gcd(a,b);
    return a/g*b;
}

int main() {
    ll N,K;
    cin >> N >> K;
    vector<ll>d(K);

    d[K-1]=1;
   
    for(ll i=K; i>0; i--){
         ll sum=0;
        for(ll j=2*i; j<K/i+1; j+=i){
            
        
         sum+=d[j-1];}
    ll z=std::pow(K/i,N);
    d[i-1]=z-sum;
    }
ll ans=0;
    rep(i,K){
ans+= d[i]*(i+1);
    }

    cout<<ans%mod <<endl;
    return 0;}

