fun longList() = readLine()?.split(" ")?.map(String::toLong) ?: TODO()
fun main() {
    val (n, m) = longList()
    (m / n).downTo(1).forEach {
        if (m % it == 0L) {
            println(it.toString())
            return
        }
    }
}
