import java.util.scanner
def gcd(a:Int,b:Int):Int={
if(b == 0)a
else{
	if(a<b)gcd(b,a)
	else gcd(b, a % b)
	}
}
object Main extends App{
	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)
}