#include<stdio.h>
#include<stdlib.h>
#include<math.h>
typedef long long ll;
//#define ll p 1000000007
ll rui(ll a,ll b)
{
  return (ll)(pow(a,b));
}

void main(void)
{
  ll N,K,ans=0;
  ll p=1000000007;
  scanf("%lld %lld",&N,&K);
  for(ll i=1;i<=K;i++){
    ans+=(i*(rui(K/i,N)-rui(K/i-1,N)))%p;
  }
  
  printf("%lld",ans);


}