#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 105
#define INF 1000000000
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define IN(a) cin>>(a)
#define OUT(a) cout<<(a)<<endl
typedef pair<int,int> P;
const int MAX = 100005;
const int MOD = 1000000007;
ll dp[MAX];
int modPow(long long a, long long n) {
  if (n == 1) return a % MOD;
  if (n % 2 == 1) return (a * modPow(a, n - 1)) % MOD;
  long long t = modPow(a, n / 2);
  return (t * t) % MOD;
}
int main(){
    int n,k;
    cin>>n>>k;
    for(int i=k;i>=1;i--){
        ll tmp=modPow((k/i),n);
        for(int j=2;(ll)j*i<=(ll)k;j++){
            tmp-=dp[j*i];
            if(tmp<0)tmp+=MOD;
            tmp%=MOD;
        }
        dp[i]=tmp;
    }
    ll ans=0;
    for(int i=1;i<=k;i++){
        ans+=(i*dp[i])%MOD;
        ans%=MOD;
    }
    OUT(ans);
    return 0;
}