let nk = readLine()!.split(separator: " ")
let n = Int(nk[0])!
let k = Int(nk[1])!
let mod = 1000000007

func pow(_ a: Int, _ n: Int, _ mod: Int? = nil) -> Int {
    var a = a
    var n = n
    var result: Int = 1
    if let unwrappedMod = mod {
        while n > 0 {
            if n & 1 == 1 {
                result = result * a % unwrappedMod
            }
            n >>= 1
            a = a * a % unwrappedMod
        }
        return result
    }
    else {
        while n > 0 {
            if n & 1 == 1 {result *= a}
            n >>= 1
            a *= a
        }
        return result
    }
}

var table = [Int: Int]()

for i in (1...k).reversed() {
    var tmp = pow((k / i), n, mod)
    for j in 2...k {
        if let unwrappedVal = table[j * i] {
            tmp -= unwrappedVal
        }
        else {break}
    }
    table[i] = tmp % mod
}

var result = 0
for (key, value) in table {
    result += key * value
    result %= mod
}
if result < 0 {
    result += mod
}

print(result)
