#include <iostream>
//^
using namespace std;


int main()
{
    long long a, b, p =-1, i = -1;
    cin >> a >>b;
    while(i<(a+1)/2 && p!=b)
    {
        i+=2;
        if(a%i == 0)
        {
            p = i^(a/i);
        }

    }
    if(p!=b)
        cout << -1;
    else
        cout << i << " " << a/i << endl;
}