import java.io._
import java.util.StringTokenizer
import scala.util.control.Breaks.{breakable,break}
import scala.collection.mutable.{Map, Stack, Queue, PriorityQueue, Set}

object Main extends App {
  val in = new InputReader(System.in)
  val pw = new PrintWriter(System.out)

  val MOD = 1e9.toInt + 7

  val N, K = in.next().toInt

  //
  def repeatSquares(x: Long, n: Int): Long = {
    if(n == 0)
      1
    else if(n % 2 == 0)
      repeatSquares(x*x % MOD, n/2)
    else
      (x * repeatSquares(x*x % MOD, n/2)) % MOD
  }

  val X = new Array[Long](K+1)

  var ans = 0L
  for (i <- (1 to K).reverse) {
    var res = repeatSquares(K / i, N)

    var n = i + i
    while (n <= K) {
      res -= X(n)
      res += MOD
      res %= MOD

      n += i
    }

    X(i) = res
    ans += res * i
    ans %= MOD
  }

  println(ans)
}


class InputReader(stream: InputStream) {
  private[this] val reader = new BufferedReader(new InputStreamReader(stream))
  private[this] var tokenizer: StringTokenizer = new StringTokenizer(reader.readLine())
  def next(): String = {
    while (!tokenizer.hasMoreTokens()) {
      tokenizer = new StringTokenizer(reader.readLine())
    }
    tokenizer.nextToken()
  }
}
