import scala.io.StdIn.readLine

object Main extends App {
  val Array(n, m) = readLine().split(' ').map(_.toInt)
  
  import scala.math._
  
  lazy val limit: Int = {
    val a: Int = sqrt(m).ceil.toInt
    val b: Int = m / n
    if (a <= b) a else b
  }
  
  if (n == 1)
    println(m)
  else {
    val result: (Int, Boolean) = (1 to limit).map { x =>
      (x, m % x == 0)
    }
      .filter(t => t._2)
      .last
    println(result._1)
  }
}