#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma comment(linker, "/STACK:2000000")

#include "bits/stdc++.h"

using namespace std;

#define pb push_back
#define F first
#define S second
#define f(i,a,b)  for(int i = a; i < b; i++)
// #define endl '\n'
using ll = long long;
using db = long double;
using ii = pair<int, int>;

const int N = 2e5+5, LG = 19, MOD = 1e9+7;
const int SQ =320;
const long double EPS = 1e-7;
int n, k;
int cnt[100005];
ll ans[100005];
int fast(int b,int e){
  int res=1;
  for(;e;e>>=1,b=1ll*b*b%MOD)
    if(e&1)res=1ll*res*b%MOD;
  return res;
}
int32_t main(){
#ifdef ONLINE_JUDGE
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif
  int n, k; cin >> n >> k;
  for(int j = 1; j <= k; j++){
    for(int i=j;i<=k;i+=j)cnt[j]++;
  }
  ll out=0;
  for(int i = k; i >= 1; --i){
    ans[i]+=fast(cnt[i],n);
    ans[i]%=MOD;
    for(int j = i+i;j<=k;j+=i)ans[i]-=ans[j];
    ans[i]%=MOD;
    if(ans[i]<0)ans[i]+=MOD;
    out+=ans[i]*i;
    out%=MOD;
  }

  cout<<out<<'\n';


  return 0;
}
