
import java.util.*

fun main(args: Array<String>) {
	val scanner = Scanner(System.`in`)
	val n = scanner.nextLong()
	val m = scanner.nextLong()
	println(calc(n, m))
}

fun calc(n: Long, m: Long): Long {
	for (i in m / n downTo 1) {
		if (m % i == 0L && m / n >= i) return i
	}
	return 1
}