// package coffee.acupof.atcoder.solution.abc162.e

import kotlin.ranges.step

const val mod = 1000000007L

fun pow(x: Long, n: Long): Long {
    return when {
        n == 0L -> 1
        n % 2 == 0L -> {
            val y = pow(x, n/2)
            (y * y) % mod
        }
        else -> {
            val y = pow(x, n/2)
            ((x * y) % mod * y) % mod
        }
    }
}

fun main() {
    val (n, k) = readLine()!!
        .split(" ")
        .map { it.toLong() }

    val memo = Array(k.toInt() + 1) { 0L }

    for (i in k downTo 1) {
        val x = (k / i)
        var m = pow(x, n)
        for (j in (i * 2)..k step i) {
            m = (m + mod - memo[j.toInt()]) % mod
        }
        memo[i.toInt()] = m
    }

    var answer = 0L
    for (j in 1..k) {
        answer =  (answer + j * memo[j.toInt()]) % mod
    }
    println(answer)
}