#include<stdio.h>
#define MODN 1000000007

static inline long mdadd(long a,long b){
    return (a + b) % MODN;
}

static inline long mdsum(long dest,long num){
    long res = (dest - num) % MODN;
    if(res < 0)res += MODN;
    return res;
}

static inline long mdml(long a,long b){
    long long res;
    res = (long long)a * b;
    return res % MODN;
}

static inline long mdpow(long num,long ind){
    unsigned long cnt = ind;
    long res = 1;
    while(cnt){
        if(cnt & 1ul)res = mdml(res,num);
        num = mdml(num,num);
        cnt >>= 1;
    }
    return res;
}

int main(void){
    register int i,j;
    int n,k;
    scanf("%d %d",&n,&k);

    long ml_num[k+1];
    for(i = 1;i <= k;i++)ml_num[i] = mdpow(k / i,n);

    long gcd_num[k+1];
    long tmp;
    for(i = k;i > 0;i--){
        tmp = 0;
        for(j = 2;i*j <= k;j++)tmp = mdadd(tmp,gcd_num[i*j]);
        gcd_num[i] = mdsum(ml_num[i],tmp);
    }
    long ans = 0;
    for(i = 1;i <= k;i++)ans = mdadd(ans,mdml(gcd_num[i],i));
    printf("%ld",ans);
}