#include <bits/stdc++.h>
#define RI register int
typedef long long LL;

#define FILEIO(name) freopen(name".in", "r", stdin), freopen(name".out", "w", stdout);

using namespace std;

int const MAXN = 1e5 + 5, mod = 1e9 + 7;
int f[MAXN];

inline int qpow(int a, int k) {
  int re = 1;
  for (; k; k >>= 1, a = a * a % mod)
    if (k & 1) re = re * a % mod;
  return re;
}

signed main() {
  
#ifdef LOCAL
  FILEIO("a");
#endif

  int n, k; cin >> n >> k;
  for (RI i = k; i; --i) {
    f[i] = qpow(k / i, n);
    for (RI j = i + i; j <= k; j += i)
      f[i] = (f[i] - f[j] + mod) % mod;
  }
  int ans = 0;
  for (RI i = 1; i <= k; ++i)
    ans = (ans + f[i] * i % mod) % mod;
  cout << ans;

  return 0;
}

// created by Daniel yuan
