import java.util.scanner


object Main extends App{
	def gcd(a:Int,b:Int):Int={
	if(b == 0)a
	else{
		if(a<b)gcd(b,a)
		else gcd(b, a % b)
		}
	}
	val sc = new Scanner(System.in)
	val a = sc.nextInt
	val b = sc.nextInt
	val d = gcd(a,b)
	val res = (1 to d).filter(d % _ == 0).reverse(k -1)
	println(res)
}