#include <bits/stdc++.h>

#define debug(s) cout << s << endl
#define debug1(s, t) cout << s << " " << t << endl
#define debug2(s, t, u) cout << s << " " << t << " " << u << endl
#define printvec(v)       \
    for (auto &&i : v)    \
        cout << i << " "; \
    cout << endl

using namespace std;
using i64 = long long;

template <int MOD>
struct Fp
{
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD)
    {
        if (val < 0)
            val += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator-() const noexcept
    {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator+(const Fp &r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator-(const Fp &r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator*(const Fp &r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator/(const Fp &r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp &operator+=(const Fp &r) noexcept
    {
        val += r.val;
        if (val >= MOD)
            val -= MOD;
        return *this;
    }
    constexpr Fp &operator-=(const Fp &r) noexcept
    {
        val -= r.val;
        if (val < 0)
            val += MOD;
        return *this;
    }
    constexpr Fp &operator*=(const Fp &r) noexcept
    {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp &operator/=(const Fp &r) noexcept
    {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b)
        {
            long long t = a / b;
            a -= t * b;
            swap(a, b);
            u -= t * v;
            swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0)
            val += MOD;
        return *this;
    }
    constexpr Fp &operator++() noexcept
    {
        val++;
        if (val >= MOD)
            val -= MOD;
        return *this;
    }
    constexpr Fp operator++(int) noexcept
    {
        Fp temp = *this;
        ++*this;
        return temp;
    }
    constexpr Fp &operator--() noexcept
    {
        val--;
        if (val < 0)
            val += MOD;
        return *this;
    }
    constexpr Fp operator--(int) noexcept
    {
        Fp temp = *this;
        --*this;
        return temp;
    }
    constexpr bool operator==(const Fp &r) const noexcept
    {
        return this->val == r.val;
    }
    constexpr bool operator!=(const Fp &r) const noexcept
    {
        return this->val != r.val;
    }
    friend constexpr ostream &operator<<(ostream &os, const Fp<MOD> &x) noexcept
    {
        return os << x.val;
    }
};

template <int MOD>
constexpr Fp<MOD> powmod(const Fp<MOD> &a, long long n) noexcept
{
    if (n == 0)
        return 1;
    if (n % 2 == 1)
        return a * powmod(a, n - 1);
    Fp<MOD> pwmd = powmod(a, n / 2);
    return pwmd * pwmd;
}

// m > n >= 0
template <class T>
T gcd(T m, T n)
{
    if (n == 0)
        return m;
    return gcd(n, m % n);
}

using mint = Fp<1000000007>;

mint rec(int L, int N, vector<mint> &memo)
{
    if (L == 1)
        return 1;
    mint sum = 0;
    for (int i = 2; i <= L; i++)
    {
        if (memo[L / i] == 0)
            sum += rec(L / i, N, memo);
        else
            sum += memo[L / i];
    }
    memo[L] = powmod(mint(L), N) - sum;
    return memo[L];
}

int main()
{
    int n, k;
    cin >> n >> k;

    mint sum = 0;
    vector<mint> memo(k + 10, 0);
    for (int i = 1; i <= k; i++)
    {
        sum += rec(k / i, n, memo) * mint(i);
    }

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 3976