#include <bits/stdc++.h>
using namespace std;

const int N = 100005;
const int MOD = 1000000007;

int power(int x, int y) {
  int ret = 1;
  for (; y; y >>= 1) {
    if (y & 1) ret = 1LL * ret * x % MOD;
    x = 1LL * x * x % MOD;
  }

  return ret;
}

int g[N];

int main() {
  int n, k;
  scanf("%d %d", &n, &k);

  int ans = 0;
  for (int i = 1; i <= k; ++i) {
    g[i] += i;
    for (int j = i*2; j <= k; j += i) {
      g[j] -= g[i];
    }

    ans = (ans + 1LL * power(k/i, n) * g[i]) % MOD;
  }

  printf("%d\n", ans);
  return 0;
}
