//by szh
#include<bits/stdc++.h>
using namespace std;

#define pb push_back
#define fi first
#define SZ(x) (int((x).size()))
#define se second
#define ll long long
#define pq priority_queue
#define MP make_pair
#define pii pair<int,int>
#define mod 1000000007
#define debug(x) cerr<<#x<<"="<<x<<'\n'

int read() {
  int x=0,w=1;
  char ch=0;
  while (ch<'0'||ch>'9') {
    if (ch=='-') w=-1;
    ch=getchar();
  }
  while (ch>='0'&&ch<='9') {
    x=(x<<3)+(x<<1)+(ch-'0');
    ch=getchar();
  }
  return x*w;
}

int p0w(ll base,int p) {
	ll res=1;
	while (p) {
		if (p%2==1) (res*=base)%=mod;
		(base*=base)%=mod;
		p/=2;
	}
	return res;
}

const int maxn=2e5+10;

int n,m;
int dif[maxn];

int main(){
	n=read(),m=read();
	int ans=0;
	for (int i=1;i<=m;i++) {
		int cur=p0w(m/i,n);
		int tmp=0;
		for (int j=1;j*j<=i;j++) {
			if (i%j) continue;
			tmp+=dif[j];
			if (j*j!=i) tmp+=dif[i/j];
		}
		tmp-=dif[i];
		dif[i]=i-tmp;
		ans+=(ll)dif[i]*(ll)cur%mod;
		ans%=mod;
	}
	printf("%d\n",ans);
	return 0;
}
