#include using namespace std; int A,B; int gcd(int a,int b){return b?gcd(b,a%b):a;} int ex[10101]; main() { cin>>A>>B; if(gcd(A,B)>1) { cout<<-1<