import java.util.Scanner

object Main {
  def main(args: Array[String]) {
    val result = solve(new Scanner(System.in))
    if (result.length > 0) println(result)
  }

  def solve(in: String): String = solve(new Scanner(in))

  def solve(sc: Scanner): String = {
    val N = sc.nextLong
    val M = sc.nextLong

    var n = N
    while (n <= 100000 && M % n != 0) {
      n += 1
    }
    if (n >= 100000) "1" else (M / n).toString
  }
}
