fun main(args: Array<String>) {
    abc112d()
}

fun abc112d() {
    val (n, m) = readLine()!!.split(' ').map { it.toLong() }

    for (i in m / n downTo 1) {
        if (m % i == 0L && m / i >= n) return println(i)
    }
}
