private fun readInts() = readLine()!!.split(" ").map { it.toInt() }.toList()

fun main(args: Array<String>) {
    val (N, M) = readInts()
    println(if (M % N == 0) M / N else (1 until M / N).asSequence().filter { M % it == 0 }.max() ?: 1)
}