#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define ll long long
const int MOD = 1e9 + 7;
const int maxn = 1e5 + 5;
ll ans[maxn];

ll qpow(ll a, ll b){
    ll res = 1;
    while(b ){
        if(b & 1) res = (res% MOD * a % MOD) %MOD;
        a = (a % MOD * a % MOD)%MOD;
        b >>= 1;
    }
    return res;
}

int main()
{
    long long  n,k;
    scanf("%lld%lld",&n,&k);
    for(long long  i = k; i >=1; i--){
        ans[i] = qpow(k/i,n);
        for(long long j = 2 *i; j <= k; j = j + i){
            ans[i] = (ans[i] - ans[j] + MOD)%MOD;
        }

    }
    ll res = 0;
    for(long long  i = 1; i <= k; i++){
            res = (res + i *ans[i])%MOD;
    }
    printf("%lld",res);
    return 0;




    return 0;
}
