object Main{
	def main(args:Array[String]){
		val s = new java.util.Scanner(System.in)
		val n,a = s.nextInt

		val r=(1 to (math.sqrt(a).toInt + 1))
				.filter(i=>a%i==0&&a/i>=n)
        		.map(i=>if(i>=n)math.max(i,a/i) else i)
				.max

		println(r)
	}
}