object Main{
  def main(args:Array[String]):Unit={
    var nm = readLine.split(" ").map(x => x.toInt)  
    var n = nm(0)
    var m = nm(1)
    var max = m/n
    var flag = true
    for(i <- max until 0 by -1 if flag){
      if(m%i==0){
        println(i)
        flag = false
      }
    }
  }
}