import Foundation

let string = readLine()!.split(separator: " ")
let N = Int(string[0])!
let K = Int(string[1])!

func pow(_ x: Int, _ y: Int) -> Int {
    NSDecimalNumber(decimal: pow(Decimal(x), y)).intValue
}
func powmod(_ base: Int, _ exponent: Int, _ mod: Int = 1_000_000_007) -> Int {
    guard exponent != 0 else { return 1 }

    var temporary = 1
    var b = base
    var p = exponent

    while p > 1 {
        if p % 2 == 1 {
            temporary = temporary * b % mod
            p -= 1
        }
        if p != 0 {
            b = b * b % mod
            p /= 2
        }
    }

    return temporary * b % mod
}

let mod = pow(10, 9) + 7

var memory = Array(repeating: 0, count: K + 1)
for i in (1 ... K).reversed() {
    var result: Int = powmod(K / i, N) % mod

    guard K / i >= 2 else {
        memory[i] = result
        continue
    }
    for j in 2 ... K / i {
        result -= memory[j * i]
    }
    memory[i] = result
}

var sum = 0
for i in 1 ... K {
    sum += (memory[i] * i % mod)
    sum %= mod
}

print(sum)
