#include <bits/stdc++.h>
 
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pii;
 
#define REP(a,b,c) for(ll (a)=(b);(a)<(c);(a)++)
#define PER(a,b,c) for(ll (a)=(b);(a)>=(c);(a)--)

ll ii(){ ll x; cin >> x; return x; }
string is(){ string x; cin >> x; return x; }
void oi(ll x){ cout << x; }
void od(ld x){ cout << fixed << setprecision(10) << x; }
void os(string x){ cout << x; }
void oie(ll x){ cout << x << endl; }
void ode(ld x){ cout << fixed << setprecision(10) << x << endl; }
void ose(string x){ cout << x << endl; }
void oe(){ cout << endl; }

ll modpow(ll a, ll n, ll m){
    ll ret=1;
    while(n>0){
        if(n&1){ ret=ret*a%m; }
        a=a*a%m;
        n>>=1;
    }
    return ret;
}

ll m=1000000007;
ll dp[200000];

int main(){
    ll N=ii();
    ll K=ii();
    ll sum=0;

    PER(i,K,1){
        dp[i]=modpow(K/i,N,m);
        for(ll j=i*2;j<=K;j+=i){
            dp[i]-=dp[j];
            dp[i]=(dp[i]+m)%m;
        }
        sum+=i*dp[i];
        sum%=m;
    }
    oie(sum);
    return 0;
}
