#include <bits/stdc++.h>
#define pb push_back
using namespace std;
long long n,k,cnt[100005],dp[100005],ans;
const long long mod = 1000000007;
long long exp(long long a , long long b){
    if(b==0)return 1;
    long long tmp = (exp(a,b/2));
    if(b%2==0)return (tmp*tmp)%mod;
    return (a*((tmp*tmp)%mod))%mod;
}

int main(){
    cin>>n>>k;
    for(int i =1;i<=k;i++){
        cnt[i]=1;
        for(int j =2*i;j<=k;j+=i)cnt[i]++;
    }
    // cout<<cnt[1]<<endl;
    for(int i =1;i<=k;i++){

        dp[i]=exp(cnt[i],n);
        // cout<<dp[i]<<endl;
    }
    for(int i =k;i>0;i--){
        for(int j = i*2;j<=k;j+=i){
            dp[i]= (dp[i]+mod-dp[j])%mod;
        }
        ans= (ans+ ((dp[i]*i)%mod))%mod;
    }
    cout<<ans<<endl;

}
