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

const long long int MOD = 1000000007;

long long int mpow(long long int x, int n)
{
    if(n == 0)
        return 1;

    long long int k = 1;
    while(n > 1)
    {
        if(n % 2 == 1)
        {
            k *= x;
            k %= MOD;
        }
        x *= x;
        x %= MOD;
        n /= 2;

    }
    return (k * x) % MOD;
}

int n, k;
ll memo[101010];

ll rec(int m)
{
    if(memo[m] != 0) return memo[m];

    ll ret = mpow(m, n);
    for(int i = 2; i <= m; i++)
    {
        ret = (MOD + ret - rec(m / i)) % MOD;
        //ret -= rec(m / i);
    }
    
    memo[m] = ret;
    return ret;
}

int main()
{
    cin >> n >> k;
    memo[1] = 1;
    ll res = 0;
    for(int i = k; i >= 1; i--)
    {
        res += (i * rec(k / i)) % MOD;
        res %= MOD;
    }
    cout << res << endl;
    
    return 0;
}