#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

const ll ansmod = 1e9 + 7;

ll dp[100010] = {0};

int main ()
{
	int n, k;
  	cin >> n >> k;
  	ll kosu[100010];
  	for(int i = 1; i <= k; i++)
    {
    	kosu[i] = pow(k / i, n);
    }
  	for(int i = k; i > 0; i--)
    {
    	dp[i] = kosu[i];
      	for(int j = 2; j * i <= k; j++)
        {
        	dp[i] -= dp[j * i];
        }
    }
  	ll ans = 0;
  	for(int i = 1; i <= k; i++)
    {
    	ans += i * dp[i];
      	ans %= ansmod;
    }
  	cout << ans % ansmod << endl;
  	}
