//#define TIMER_
#include <bits/stdc++.h>
using namespace std;
#define rep(i,r) for(int i = 0; i < (r); i++)
#define pb push_back
#define ALL(a) a.begin(), a.end()
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using ll = long long;
using ull = unsigned long long;
int n, k;
const int maxn = 1e5+10;
int dp[maxn];
const int md = 1e9 + 7;

inline int mul(int a, int b) {
  return (int) ((long long) a * b % md);
}

inline void add(int &a, int b) {
 a += b;
 if (a >= md) a -= md;
}

inline void sub(int &a, int b) {
  a -= b;
  if (a < 0) a += md;
}

inline int mdpow(int a, long long b) {
  int res = 1;
  while (b > 0) {
    if (b & 1) {
      res = mul(res, a);
    }
    a = mul(a, a);
    b >>= 1;
  }
  return res;
}

inline int inv(int a) {
  a %= md;
  if (a < 0) a += md;
  int b = md, u = 0, v = 1;
  while (a) {
    int t = b / a;
    b -= t * a; swap(a, b);
    u -= t * v; swap(u, v);
  }
  assert(b == 1);
  if (u < 0) u += md;
  return u;
}

int main() {
  fastio;
  cin >> n >> k;
  for (int i = k; i >= 1; i--) {
    dp[i] = mdpow(k/i, n);
  }

  for (int i = k; i >= 1; i--) {
    for (int j = i + i; j <= k; j += i) {
      sub(dp[i], dp[j]);
    }
  }

  int res = 0;
  for (int i = 1; i <= k; i++) {
    add(res, mul(dp[i], i));
  }

  cout << res << "\n";
  
  #ifdef TIMER_
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
  #endif
}
