#include <bits/stdc++.h>

using namespace std;
const int N = 1e5 + 5, MOD = 1e9 + 7;
int dp[N];

int mul(int a, int b) {return 1ll * a * b % MOD;}
int sum(int a, int b) {return (a + b) % MOD;}
int Pow(int a, int b) {
    int res = 1;
    for (; b; b>>=1, a = mul(a, a)) if (b&1) res = mul(res, a);
    return res;
}
int calc(int n) {
    int res = 0;
    for (int i = 2; i <= n;) {
        int j = n / (n / i) + 1;
        dp[n] = sum(dp[n], MOD - mul(dp[n/i], j - i));
        i = j;
    }
}
int main() {
    int n, k; cin >> n >> k;
    for (int i = 1; i <= k; i++) {
        dp[i] = Pow(i, n);
        calc(i);
    }
    int ans = 0;
    for (int i = 1; i <= k; i++) ans = sum(ans, mul(i, dp[k/i]));
    cout << ans << "\n";

    return 0;
}
