import scala.io.StdIn._
object Main extends App {
  val mod = 1000000007L
  val Array(n, k) = readLine.trim.split(' ').map(_.toInt)
  if (n > k) println(0)
  else {
    val factorial = Array.fill(k + 1){1L}
    val inverse = Array.fill(k + 1){1L}
    val inverseFactorial = Array.fill(k + 1){1L}
    for (i ← 2 to k) {
      factorial(i) = i * factorial(i - 1) % mod
      inverse(i) = (mod - mod / i) * inverse((mod % i).toInt) % mod
      inverseFactorial(i) = inverse(i) * inverseFactorial(i - 1) % mod
    }
    println(factorial(k) * inverseFactorial(k - n) % mod)
  }
}

