/*
 * Author: Anmol Choudhary
 */
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
#include<bits/stdc++.h>
// using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define rep0(a,b) for(int a=0;a<b;a++)
#define rep1(a,b) for(int a=1;a<=b;a++)
#define repp(a,b,c) for(int a=b;a<c;a++)
#define in insert
#define len length()
#define si size()
#define lb lower_bound
#define ub upper_bound
#define beg begin()
#define en end()
#define f first
#define s second
#define pr(a) cout<<a
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define nx cout<<"\n"
#define int long long
//void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
                                                     
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]"<<endl;}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif
const ll mod = 1000000007;
const ll maxn = 100005;
const ll mm = 1e+18;
int dp[maxn];
ll power(ll x, ll y)
{
   ll res = 1;
   x = x % mod;
   while (y > 0)
   {
       if (y & 1)
            res = (res*x) %mod;
       y = y>>1;
       x = (x*x) %mod;
   }
   return res;
}
int f(int n,int k){
    int ans1=n/k;
    int ans2=n/(k+1);
    // int l=2;
    // int r=n+1;
    // while(l<r){
    //     int mid=(l+r)>>1;
    //     if(n/mid==k){
    //         ans1=mid;
    //         r=mid;
    //     }
    //     else if((n/mid)>k){
    //         l=mid+1;
    //     }
    //     else r=mid;
    // }
    // l=2;
    // r=n+1;
    // while(l<r){
    //     int mid=(l+r)>>1;
    //     if(n/mid==k){
    //         l=mid+1;
    //         ans2=mid;
    //     }
    //     else if((n/mid)>k){
    //         l=mid+1;
    //     }
    //     else r=mid;
    // }
    return (ans1-ans2);
}
void solve()
{
    dp[1]=1;
    int n,k;
    cin>>n>>k;
    for(int i=2;i<maxn;i++){
        dp[i]=power(i,n);
        int tot=0;
        for(int j=2;j<=i;j++){
            tot++;
            if((int)(i/j)>(int)sqrt(i)) dp[i]=(dp[i]-dp[i/j]+mod)%mod;
            else break;
        }
        //assert(tot<=sqrt(i));
        for(int j=1;j<=sqrt(i);j++){
            //if(i==6){deb(i,j,f(i,j));}
            dp[i]=(dp[i]-(f(i,j)*dp[j])%mod+mod)%mod;
        }
        //if(i<=20){deb(dp[i]);}
    }
    int an=0;
    for(int i=1;i<=k;i++){
        an=(an+(i*dp[k/i])%mod)%mod;
    }
    pr(an);
}
signed main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--){
        solve();
        //nx;
    }
    return 0;
}


Measured memory_bytes: 4476