#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
#define  st first
#define  nd second
void debug_out() { cerr << endl; }
template<class T> ostream& prnt(ostream& out, T v) { out << v.size() << '\n'; for(auto e : v) out << e << ' '; return out;}
template<class T> ostream& operator<<(ostream& out, vector <T> v) { return prnt(out, v); }
template<class T> ostream& operator<<(ostream& out, set <T> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, map <T1, T2> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, pair<T1, T2> p) { return out << '(' << p.st << ' ' << p.nd << ')'; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}
 
#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(int _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!\n"
 
 
#define MOD   1000000007
const int LN =19;
#define int long long
const int  MAXN = 100004;
 
template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
typedef cc_hash_table<int, int, hash<int > > ht;
 
int mu[MAXN];
int f[MAXN];
int n , k ; 
void mobius(){
     mu[1] = 1;
	 for (int i = 1; i < MAXN; i++)
		for (int j = 2*i; j < MAXN; j += i)
		{
				mu[j] -= mu[i];
		}
}
 
int modular_pow(int  base, int exponent, int modulus)
{
    int result = 1;
    while (exponent > 0)
    {
        if (exponent % 2 == 1)
            result = (result * base) % modulus;
        exponent = exponent >> 1;
        base = (base * base) % modulus;
    }
    return result;
}
int fact[MAXN];
int invf[MAXN]; 

void fun(){
  for(int i=1;i<MAXN;i++){
    for(int j=i;j<MAXN;j+=i){
        f[j]= ((f[j]+((i*mu[j/i])%MOD))%MOD + MOD)%MOD;
    }
  }
 
}
int solve(){
   int ans=0;
   for(int d=1;d<=k;d++){
    ans=(ans+((f[d]* modular_pow(k/d,n ,MOD))%MOD))%MOD;
   }
   return ans;
}
void precal(){
  fact[0] = 1 ; 
  for(int i = 1; i<MAXN ; i++){
      fact[i] = (fact[i-1]*i)%MOD;
      invf[i] = modular_pow(fact[i],MOD-2,MOD);
  }
  mobius();
  fun();
}
int32_t main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  precal();
  cin >> n >> k ;
  cout<<solve();
}
 
 