#include <iostream>
#include <cmath>
using namespace std;
int main(){
int y,res,a,b,c;
cin>>a>>b;
for(int x=3; x<=a; x++){
    if(a%x==0 && x%2==1){
        y=a/x;
        res=(x | y) & (~x | ~y);
        if(res==b){
            cout << x <<" "<< y;
            break;
        }
            else{
                cout<<"-1";
            }
    }
}
return 0;
}