#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long LL;

const LL MOD = 1000000007LL;

LL modpow(LL x, LL n) {
  LL r = 1;
  while(n != 0) {
    if(n&1) r = r * x % MOD;
    x = x * x % MOD;
    n >>= 1;
  }
  return r;
}

int main() {
  int N, K;
  cin >> N >> K;
  vector<LL> count(N+1);
  LL ret = 0;
  for(int i=K; i>=1; --i) {
    LL n = modpow(K / i, N);
    for(int j=i*2; j<=K; j+=i) {
      n = (n + MOD - count[j]) % MOD;
    }
    count[i] = n;
    ret = (ret + n * i) % MOD;
  }
  cout << ret << endl;
}