#include<bits/stdc++.h>
using namespace std;
const int mod=1000000007;
int N,K;
long ans;
vector<long> X(100100);
long power(long a, long n, long m)
{
        long ret = 1;
        for (; n > 0; n >>= 1, a = a * a % m)
        {
                if (n % 2 == 1)
                {
                        ret = ret * a % m;
                }
        }
        return ret;
}

vector<long> divisor(long n)
{
        vector<long> res;
        for(long i = 1; i * i <= n; i++)
        {
                if(n % i == 0)
                {
                        res.push_back(i);
                        if(i * i != n) res.push_back(n / i);
                }
        }
        sort(res.begin(), res.begin());
        return res;
}

main()
{
        cin>>N>>K;
        for(int i=K;i>0;i--)
        {
                long res=((power(K/i,N,mod)-X[i])%mod+mod)%mod;
                ans=(ans+res*i+mod)%mod;
                vector<long> d=divisor(i);
                for(auto &it : d)X[it]=(X[it]+res+mod)%mod;
        }
        cout<<ans<<endl;
}