#include <bits/stdc++.h>
using namespace std;

int gcd (int a, int b) {
	while (b) {
		a %= b;
		swap (a, b);
	}
	return a;
}

int lcm (int a, int b) {
	return a / gcd (a, b)*b;
}

main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin >> t;
    while(t--){
        int a,b;
        cin >> a >> b;
        bool z=0;
        for(int i=a;i<=b;i++){
            for(int j=i+1;j<=b;j++){
                int k=lcm(i,j);
                if(k>=a&&k<=b){
                    cout << i << ' ' << j << '\n';
                    z=true;
                    break;
                }
            }
            if(z) break;
        }
        if(!z) cout << "-1 -1" << '\n';
    }
}


#pragma GCC optimize("O2")

#include <bits/stdc++.h>
using namespace std;

#define w(x)  \
    int x;    \
    cin >> x; \
    while (x--)
#define endl "\n"
#define max(a, b) (a < b ? b : a)
#define min(a, b) ((a > b) ? b : a)
typedef long long ll;
#define mk(arr, n, type) type *arr = new type[n]
const int mod = 1000000007;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

void b_v_r()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

int main()
{
    b_v_r();
    ll l, r;
    w(t)
    {
        cin >> l >> r;
        bool flag = true;
        ll x = l,y = r,lcm;
        for(x=l;x<y;x++)
        {
            for(y=r;y>x;y--)
            {
                lcm = (x*y)/(__gcd(x,y));
                if(lcm>=l && lcm<=y)
                {
                    cout << x << " " << y << endl;
                    flag = false;
                    break;
                }
            }
            if(flag==false)
            {
                break;
            }
        }

        if(flag)
        {
            cout << "-1" << " " << "-1" << endl;
        }

    }

    return 0;
}


#pragma GCC optimize("O2")

#include <bits/stdc++.h>
using namespace std;

#define w(x)  \
    int x;    \
    cin >> x; \
    while (x--)
#define endl "\n"
#define max(a, b) (a < b ? b : a)
#define min(a, b) ((a > b) ? b : a)
typedef long long ll;
#define mk(arr, n, type) type *arr = new type[n]
const int mod = 1000000007;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

void b_v_r()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

int main()
{
    b_v_r();
    ll l, r;
    w(t)
    {
        cin >> l >> r;
        bool flag = true;
        ll x = l,y = r,lcm;
        for(y=r;y>x;y--)
        {
            for(x=y-1;x>=l;x--)
            {
                lcm = (x*y)/(__gcd(x,y));
                if(lcm>=l && lcm<=y)
                {
                    cout << x << " " << y << endl;
                    flag = false;
                    break;
                }
            }
            if(flag==false)
            {
                break;
            }
        }

        if(flag)
        {
            cout << "-1" << " " << "-1" << endl;
        }

    }

    return 0;
}


#pragma GCC optimize("O2")

#include <bits/stdc++.h>
using namespace std;

#define w(x)  \
    int x;    \
    cin >> x; \
    while (x--)
#define endl "\n"
#define max(a, b) (a < b ? b : a)
#define min(a, b) ((a > b) ? b : a)
typedef long long ll;
#define mk(arr, n, type) type *arr = new type[n]
const int mod = 1000000007;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

void b_v_r()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

int main()
{
    b_v_r();
    ll l, r;
    w(t)
    {
        cin >> l >> r;
        bool flag = true;
        ll x = l,y = r,lcm;
        for(x=l;x<y;x++)
        {
            for(y=x+1;y<=r;y++)
            {
                lcm = (x*y)/(__gcd(x,y));
                if(lcm>=l && lcm<=y)
                {
                    cout << x << " " << y << endl;
                    flag = false;
                    break;
                }
            }
            if(flag==false)
            {
                break;
            }
        }

        if(flag)
        {
            cout << "-1" << " " << "-1" << endl;
        }

    }

    return 0;
}


#pragma GCC optimize("O2")

#include <bits/stdc++.h>
using namespace std;

#define w(x)  \
    int x;    \
    cin >> x; \
    while (x--)
#define endl "\n"
#define max(a, b) (a < b ? b : a)
#define min(a, b) ((a > b) ? b : a)
typedef long long ll;
#define mk(arr, n, type) type *arr = new type[n]
const int mod = 1000000007;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

void b_v_r()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

int main()
{
    b_v_r();
    ll l, r;
    w(t)
    {
        cin >> l >> r;

        if (r - l == 1)
        {
            cout << "-1 -1" << endl;
            continue;
        }

        ll x = l, y = r;

        ll lcm = (x*y) / (__gcd(x, y));
        // cout << "lcm : " << lcm << endl;

        if (lcm >= l && lcm <= r)
        {
            cout << x << " " << y << endl;
            continue;
        }
        else
        {
            bool flag = true;
            ll xtemp = x;
            ll ytemp = y;
            while (flag)
            {
                ytemp--;
                lcm = (xtemp*ytemp) / (__gcd(xtemp, ytemp));
                if (lcm >= l && lcm <= r)
                {
                    cout << xtemp << " " << ytemp << endl;
                    flag = false;
                    break;
                }
            }
            while (flag)
            {
                x++;
                lcm = (x*y) / (__gcd(x, y));
                if (lcm >= l && lcm <= r)
                {
                    cout << x << " " << y << endl;
                    flag = false;
                    break;
                }
            }

            if(flag)
            {
                cout << "-1 -1" << endl;
            }
            else
            {
                continue;
            }

        }
    }

    return 0;
}


#pragma GCC optimize("O2")

#include <bits/stdc++.h>
using namespace std;

#define w(x)    int x; cin>>x; while(x--)
#define endl 	"\n"
#define max(a, b) (a < b ? b : a)
#define min(a, b) ((a > b) ? b : a)
typedef long long ll;
#define mk(arr,n,type)   type *arr=new type[n]
const int mod=1000000007;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

void b_v_r()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

int main()
{
    b_v_r();
    ll l,r;
    w(t)
    {
        cin >> l >> r;

        if(r>=(2*l))
        {
            cout << l << " " << 2*l << endl;
        }
        else
        {
            cout << "-1 -1" << endl;
        }

    }

    return 0;
}


#pragma GCC optimize("O2")

#include <bits/stdc++.h>
using namespace std;

#define w(x)  \
    int x;    \
    cin >> x; \
    while (x--)
#define endl "\n"
#define max(a, b) (a < b ? b : a)
#define min(a, b) ((a > b) ? b : a)
typedef long long ll;
#define mk(arr, n, type) type *arr = new type[n]
const int mod = 1000000007;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

void b_v_r()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

int main()
{
    b_v_r();
    ll l, r;
    w(t)
    {
        cin >> l >> r;

        if (r - l == 1)
        {
            cout << "-1 -1" << endl;
            continue;
        }

        ll x = l, y = r;

        ll lcm = (x*y) / (__gcd(x, y));
        // cout << "lcm : " << lcm << endl;

        if (lcm >= l && lcm <= r)
        {
            cout << x << " " << y << endl;
            continue;
        }
        else
        {
            bool flag = true;
            ll xtemp = x;
            ll ytemp = y;
            while (flag)
            {
                ytemp--;
                lcm = (xtemp*ytemp) / (__gcd(xtemp, ytemp));
                if (lcm >= l && lcm <= r)
                {
                    cout << xtemp << " " << ytemp << endl;
                    flag = false;
                    break;
                }
            }
            while (flag)
            {
                x++;
                lcm = (x*y) / (__gcd(x, y));
                if (lcm >= l && lcm <= r)
                {
                    cout << x << " " << y << endl;
                    flag = false;
                    break;
                }
            }
        }
    }

    return 0;
}


#include<iostream>
#include<math.h>
#include<string.h>
#include<algorithm>
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    if(b>=2*a)cout<<a<<" "<<2*a<<endl;
    else cout<<"-1 -1";
}


#include<iostream>
#include<math.h>
#include<string.h>
#include<algorithm>
using namespace std;
int main()
{
    int t,l,r;
    cin>>t;
    while(t--)
    {
        cin>>l>>r;
        cout<<l<<" "<<l<<endl;
    }
}


#include<iostream>
#include<math.h>
#include<string.h>
#include<algorithm>
using namespace std;
int main()
{
    int t,a,b;
    cin>>t;
    while(t--)
    {
        cin>>a>>b;
        if(b>=2*a)cout<<a<<" "<<2*a;
        else cout<<"-1 -1";
    }
}


#include<iostream>
#include<math.h>
#include<string.h>
#include<algorithm>
using namespace std;
int main()
{
    int t,a,b;
    cin>>t;
    while(t--)
    {
        cin>>a>>b;
        if(b>=2*a)cout<<a<<" "<<2*a<<endl;
        else cout<<"-1 -1"<<endl;
    }
}


#include<iostream>
#include<math.h>
#include<string.h>
#include<algorithm>
using namespace std;
int main()
{
    int t,a,b;
    cin>>t;
    while(t--)
    {
        cin>>a>>b;
        if(b>=2*a)cout<<a<<" "<<2*a<<endl;
        else cout<<"-1 -1";
    }
}


#include<iostream>
#include<math.h>
#include<string.h>
#include<algorithm>
using namespace std;
int main()
{
    int n;
    cin>>n;
    cout<<25;
}


#include<bits/stdc++.h>
#define MAX 1000005
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    bool flag = false;
    long long int t,l,r,varr;
    cin>>t;
    while(t--)
    {
        flag=false;
        cin>>l>>r;
        for(long long int i=l;i<=r;i++)
        {
            varr=i*2;
            for(long long int j=i+1;j<=r;j++)
            {
                if(j==varr)
                {
                    cout<<i<<" "<<j<<"\n";
                    flag=true;
                    break;
                }
            }
            if(flag)
            {
                break;
            }
            if(i==r)
                cout<<-1<<" "<<-1<<"\n";
        }

    }
}


#include<bits/stdc++.h>
#define MAX 1000005
using namespace std;

long long int gcd(long long int a, long long int b)
{
    if(a == 0)
        return b;
    return gcd(b % a,a);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    bool flag = false;
    long long int t,l,r,gcdvar,lcm;
    cin>>t;
    while(t--)
    {
        flag=false;
        cin>>l>>r;
        for(long long int i=l;i<=r;i++)
        {
            for(long long int j=i+1;(j<=r) && (r<=i*j);j++)
            {
                if(j%i == 0)
                {
                    cout<<i<<" "<<j<<"\n";
                    flag = true;
                    break;
                }
                gcdvar=gcd(i,j);
                lcm=(i*j)/gcdvar;
                if(lcm<=r && lcm>=l)
                {
                    cout<<i<<" "<<j<<"\n";
                    flag = true;
                    break;
                }
            }
            if(flag)break;
            if(i==r)
            {
                cout<<-1<<" "<<-1<<"\n";
            }
        }

    }
}


#include<bits/stdc++.h>
#define MAX 1000005
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    bool flag = false;
    long long int t,l,r,varr;
    cin>>t;
    while(t--)
    {
        flag=false;
        cin>>l>>r;
        for(long long int i=l;i<=r;i++)
        {
            varr=i*2;
                if(varr<=r)
                {
                    cout<<i<<" "<<varr<<"\n";
                    flag=true;
                    break;
                }
            if(i==r)
                cout<<-1<<" "<<-1<<"\n";
        }

    }
}


#include<bits/stdc++.h>
#define MAX 1000005
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    bool flag = false;
    long long int t,l,r,varr;
    cin>>t;
    while(t--)
    {
        flag=false;
        cin>>l>>r;
        for(long long int i=l;i<=r;i++)
        {
            varr=i*2;
                if(varr<=r)
                {
                    cout<<i<<" "<<varr<<"\n";
                    flag=true;

                }
                else
                    cout<<-1<<" "<<-1<<"\n";

                    break;

        }
    }
}


#include<bits/stdc++.h>
#define MAX 1000005
using namespace std;

long long int gcd(long long int a, long long int b)
{
    if(a == 0)
        return b;
    return gcd(b % a,a);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    bool flag = false;
    long long int t,l,r,gcdvar,lcm;
    cin>>t;
    while(t--)
    {
        flag=false;
        cin>>l>>r;
        for(long long int i=l;i<=r;i++)
        {
            for(long long int j=i+1;j<=r;j++)
            {
                gcdvar=gcd(i,j);
                lcm=(i*j)/gcdvar;
                if(lcm<=r && lcm>=l)
                {
                    cout<<i<<" "<<j<<"\n";
                    flag = true;
                    break;
                }
            }
            if(flag)break;
            if(i==r)
            {
                cout<<-1<<" "<<-1<<"\n";
            }
        }

    }
}


#include<bits/stdc++.h>
#define MAX 1000005
using namespace std;

long long int gcd(long long int a, long long int b)
{
    if(a == 0)
        return b;
    return gcd(b % a,a);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    bool flag = false;
    long long int t,l,r,gcdvar,lcm;
    cin>>t;
    while(t--)
    {
        flag=false;
        cin>>l>>r;
        for(long long int i=l;i<=r;i++)
        {
            for(long long int j=i+1;j<=r;j++)
            {
                if(j%i == 0)
                {
                    cout<<i<<" "<<j<<"\n";
                    flag = true;
                    break;
                }
                gcdvar=gcd(i,j);
                lcm=(i*j)/gcdvar;
                if(lcm<=r && lcm>=l)
                {
                    cout<<i<<" "<<j<<"\n";
                    flag = true;
                    break;
                }
            }
            if(flag)break;
            if(i==r)
            {
                cout<<-1<<" "<<-1<<"\n";
            }
        }

    }
}


#include<bits/stdc++.h>
#define MAX 1000005
using namespace std;

long long int gcd(long long int a, long long int b)
{
    if(a == 0)
        return b;
    return gcd(b % a,a);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    bool flag = false;
    long long int t,l,r,gcdvar,lcm;
    cin>>t;
    while(t--)
    {
        flag=false;
        cin>>l>>r;
        for(long long int i=l;i<=r;i++)
        {
            for(long long int j=i+1;(j<=r) && (r<i*j);j++)
            {
                if(j%i == 0)
                {
                    cout<<i<<" "<<j<<"\n";
                    flag = true;
                    break;
                }
                gcdvar=gcd(i,j);
                lcm=(i*j)/gcdvar;
                if(lcm<=r && lcm>=l)
                {
                    cout<<i<<" "<<j<<"\n";
                    flag = true;
                    break;
                }
            }
            if(flag)break;
            if(i==r)
            {
                cout<<-1<<" "<<-1<<"\n";
            }
        }

    }
}


/*
Author : Harsh AKA Codula
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long

class google
{

    public:
        void run()
        {
            ll a;
            cin>>a;
            int i=0;
            while(a--)
            {
                i+=1;
                cout<<"Cases #"<<i<<": ";
                cout<<"\n";
            }
        }
};
class codechefpattern
{

    public:
        void run()
        {
            ll a;
            cin>>a;
            while(a--)
            {
                ll a,b,a1,a2;
                cin>>a>>b;
                if ((2*a)<=b)
                {
                    /* code */
                    a1=a;
                    a2=2*a;
                    cout<<a1<<" "<<a2;
                }
                else
                {
                    cout<<"-1 "<<"-1";
                }
                cout<<"\n";

        }
};
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    google g;
    codechef c;
    c.run();
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t;
    cin>>t;
    while(t--)
    {
        ll a,b,a1,a2;
        cin>>a>>b;
        if (abs(a-b)!=1)
        {
            /* code */
            a1=a+1;
            a2=a1;
            cout<<a1<<" "<<a2<<"\n";
        }
        else{
            cout<<"-1"<<" -1"<<"\n";
        }

    }
    return 0;
}


#include<bits/stdc++.h>

using namespace std;
#define ll long long
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t;
    cin>>t;
    while(t--)
    {
        ll a,b,a1,a2;
        cin>>a>>b;
        if ((2*a)<=b)
        {
            /* code */
            a1=a;
            a2=2*a;
            cout<<a1<<" "<<a2;
        }
        else
        {
            cout<<"-1 "<<"-1";
        }
        cout<<"\n";
    }
    return 0;
}


#include<bits/stdc++.h>
class maths
{
 public : int gcd(int a, int b){
    if (a == 0)
        return b;
    return gcd(b % a, a);
 }

// Function to return LCM of two numbers
  int lcm(int a, int b)
 {
    return (a*b)/gcd(a, b);
 }
} ;
using namespace std;
#define ll long long
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t;
    cin>>t;
    while(t--)
    {
        maths m;
        ll a,b,a1,a2;
        cin>>a>>b;
        if (abs(a-b)!=1)
        {
            /* code */
            ll i=a;
            ll i1=i+1;
            while(m.lcm(i,i1)>b)
            {
                i1+=1;
            }
            cout<<i<<" "<<i1<<"\n";
        }
        else{
            cout<<"-1"<<" -1"<<"\n";
        }

    }
    return 0;
}


#include<iostream>
using namespace std;
#define ll long long
class Solution
{
	public:
		void run()
		{
			ll t;
			cin>>t;
			while(t--)
			{
			 	ll a,b,a1,a2;
			 	cin>>a>>b;
			 	if((2*a)<=b)
			 	{
			 	 	cout<<a<<" "<<2*a;
			 	}
			 	else
			 	{
			 		cout<<"-1 -1";
			 	}
			 	cout<<"\n";
	        }
		}
};
int main()
{
 	Solution MAIN1;
 	MAIN1.run();
 	return 0;
}


/*
Author : Harsh AKA Codula
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long

class google
{

    public:
        void run()
        {
            ll a;
            cin>>a;
            int i=0;
            while(a--)
            {
                i+=1;
                cout<<"Cases #"<<i<<": ";
                cout<<"\n";
            }
        }
};
class codechefpattern
{

    public:
        void run()
        {
            ll a;
            cin>>a;
            while(a--)
            {
                ll a,b,a1,a2;
                cin>>a>>b;
                if ((2*a)<=b)
                {
                    /* code */
                    a1=a;
                    a2=2*a;
                    cout<<a1<<" "<<a2;
                }
                else
                {
                    cout<<"-1 "<<"-1";
                }
                cout<<"\n";

        }
};
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    google g;
    codechefpattern c;
    c.run();
}


/*
Author : Harsh AKA Codula
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long

class google
{

    public:
        void run()
        {
            ll a;
            cin>>a;
            int i=0;
            while(a--)
            {
                i+=1;
                cout<<"Cases #"<<i<<": ";
                cout<<"\n";
            }
        }
};
class codechefpattern
{

    public:
        void run()
        {
            ll a;
            cin>>a;
            while(a--)
            {
                ll a,b,a1,a2;
                cin>>a>>b;
                if ((2*a)<=b)
                {
                    /* code */
                    a1=a;
                    a2=2*a;
                    cout<<a1<<" "<<a2;
                }
                else
                {
                    cout<<"-1 "<<"-1";
                }
                cout<<"\n";
            }

        }
};
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    google g;
    codechefpattern c;
    c.run();
}


#include <iostream>

using namespace std;

int main()
{
    long long int t{}, l{}, r{};
    cin >> t ;
    while(t--)
    {
        int found{0} ;
        cin >> l >> r ;
        for(long long int i{l} ; i < r ; ++i)
            {
                if(r%i == 0)
                {
                    cout << i <<' '<< r << endl ;
                    found++ ;
                    break ;
                }
            }
        if(!found)
        {
            for(long long int i{r} ; i > l ; --i)
                {
                    if(i%l == 0)
                    {
                        cout << l <<' '<< i << endl ;
                        found++ ;
                        break ;
                    }
                }

        }
        if(!found) cout << -1 <<' '<< -1 << endl ;
    }
    return 0;
}


#include <iostream>

using namespace std;

int main()
{
    long long int t{}, l{}, r{};
    cin >> t ;
    while(t--)
    {
        cin >> l >> r ;
        if(r > l)
        {
            for(long long int i{l} ; i < r ; ++i)
               {
                   if(r%i == 0)
                   {
                       cout << i <<' '<< r << endl ;
                       break ;
                   }
                   else if(i == r-1) cout << -1 <<' '<< -1 << endl ;
               }
        }
        else if(l > r)
        {
            for(long long int i{r} ; i < l ; ++i)
               {
                   if(l%i == 0)
                   {
                       cout << i <<' '<< l << endl ;
                       break ;
                   }
                   else if(i == l-1) cout << -1 <<' '<< -1 << endl ;
               }
        }
        else cout << -1 <<' '<< -1 << endl ;
    }
    return 0;
}


#include <iostream>

using namespace std;

int main()
{
    long long int t{}, l{}, r{};
    cin >> t ;
    int found{0} ;
    while(t--)
    {
        cin >> l >> r ;
        if(r > l)
        {
            for(long long int i{l} ; i < r ; ++i)
               {
                   if(r%i == 0)
                   {
                       cout << i <<' '<< r << endl ;
                       found++ ;
                       break ;
                   }
               }
        }
        else if(l > r)
        {
            for(long long int i{r} ; i < l ; ++i)
               {
                   if(l%i == 0)
                   {
                       cout << i <<' '<< l << endl ;
                       found++ ;
                       break ;
                   }
               }
        }
        if(!found)
        {
            if(r > l)
            {
                for(long long int i{r} ; i > l ; --i)
                   {
                       if(i%l == 0)
                       {
                           cout << l <<' '<< i << endl ;
                           found++ ;
                           break ;
                       }
                   }
            }
            else if(l > r)
            {
                for(long long int i{l} ; i > r ; --i)
                   {
                       if(i%l == 0)
                       {
                           cout << r <<' '<< i << endl ;
                           found++ ;
                           break ;
                       }
                   }
            }
        }
        else if(!found) cout << -1 <<' '<< -1 << endl ;
    }
    return 0;
}


#include <iostream>

using namespace std;

int main()
{
    long long int t{}, l{}, r{};
    cin >> t ;
    while(t--)
    {
        int found{0} ;
        cin >> l >> r ;
        if(r > l)
        {
            for(long long int i{l} ; i < r ; ++i)
               {
                   if(r%i == 0)
                   {
                       cout << i <<' '<< r << endl ;
                       found++ ;
                       break ;
                   }
               }
        }
        else if(l > r)
        {
            for(long long int i{r} ; i < l ; ++i)
               {
                   if(l%i == 0)
                   {
                       cout << i <<' '<< l << endl ;
                       found++ ;
                       break ;
                   }
               }
        }
        if(!found)
        {
            if(r > l)
            {
                for(long long int i{r} ; i > l ; --i)
                   {
                       if(i%l == 0)
                       {
                           cout << l <<' '<< i << endl ;
                           found++ ;
                           break ;
                       }
                   }
            }
            else if(l > r)
            {
                for(long long int i{l} ; i > r ; --i)
                   {
                       if(i%l == 0)
                       {
                           cout << r <<' '<< i << endl ;
                           found++ ;
                           break ;
                       }
                   }
            }
        }
        if(!found) cout << -1 <<' '<< -1 << endl ;
    }
    return 0;
}


#include <iostream>

using namespace std;

int main()
{
    long long int t{}, l{}, r{};
    cin >> t ;
    while(t--)
    {
        int found{0} ;
        cin >> l >> r ;
        if(r/l >= 2) cout << l <<' '<< 2*l << endl ;
        else cout << -1 <<' '<< -1 << endl ;
    }
    return 0;
}


#include <iostream>

using namespace std;

int main()
{
    long long int t{}, l{}, r{};
    cin >> t ;
    int found{0} ;
    while(t--)
    {
        cin >> l >> r ;
        if(r > l)
        {
            for(long long int i{l} ; i < r ; ++i)
               {
                   if(r%i == 0)
                   {
                       cout << i <<' '<< r << endl ;
                       found++ ;
                       break ;
                   }
               }
        }
        else if(l > r)
        {
            for(long long int i{r} ; i < l ; ++i)
               {
                   if(l%i == 0)
                   {
                       cout << i <<' '<< l << endl ;
                       found++ ;
                       break ;
                   }
               }
        }
        if(!found)
        {
            if(r > l)
            {
                for(long long int i{r} ; i > l ; --i)
                   {
                       if(i%l == 0)
                       {
                           cout << l <<' '<< i << endl ;
                           break ;
                       }
                   }
            }
            else if(l > r)
            {
                for(long long int i{l} ; i > r ; --i)
                   {
                       if(i%l == 0)
                       {
                           cout << r <<' '<< i << endl ;
                           break ;
                       }
                   }
            }
        }
        else cout << -1 <<' '<< -1 << endl ;
    }
    return 0;
}


#include <iostream>

using namespace std;

int main()
{
    long long int t{}, l{}, r{};
    cin >> t ;
    while(t--)
    {
        cin >> l >> r ;
        cout << l <<' '<< l*r << endl ;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll t;
    cin >> t;
    while(t--)
    {
        ll l,r;
        cin >> l >> r;
        if(l* l+1  <=r)
        cout << l << " " << l+1 << '\n';
        else if(l*(2*l)/(__gcd(l,2*l)) <= r)
        cout << l << " " << 2*l << '\n';
        else if(r%l == 0)
        cout << l << " " << r << '\n';
        else
        cout << "-1 " << "-1" << '\n';

    }

 }


#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll t;
    cin >> t;
    while(t--)
    {
        ll l,r;
        cin >> l >> r;
        if(l* l+1  <=r)
        cout << l << " " << l+1 << '\n';
        else if(2*l <= r)
        cout << l << " " << 2*l << '\n';
        else
        cout << "-1 " << "-1" << '\n';

    }

 }


#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll t;
    cin >> t;
    while(t--)
    {
        ll l,r;
        cin >> l >> r;
        ll a1 = -1,a2 = -1;
        if(l == 1 and r == 2)
        cout << l << " " << r << '\n';
        else
        {
            for(ll i = l;i<=r-1;i++)
            {
                for(ll j = i+1;j<=r;j++)
                {
                    if((i*j)/(__gcd(i,j)) <= r)
                    {
                        a1 = i;
                        a2 = j;
                        goto print;
                    }
                }
            }

        }
         print :
                cout << a1 << " "  << a2 << '\n';

    }
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll t;
    cin >> t;
    while(t--)
    {
        ll l,r;
        cin >> l >> r;
        if(2*l <= r)
        cout << l << " " << 2*l << '\n';
        else
        cout << "-1 " << "-1" << '\n';

    }

 }


#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll t;
    cin >> t;
    while(t--)
    {
        ll l,r;
        cin >> l >> r;
        if(l* l+1  <=r)
        cout << l << " " << l+1 << '\n';
        else if(l*(2*l)/(__gcd(l,2*l)) <= r and 2*l <=r)
        cout << l << " " << 2*l << '\n';
        else
        cout << "-1 " << "-1" << '\n';

    }

 }


#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll t;
    cin >> t;
    while(t--)
    {
        ll l,r;
        cin >> l >> r;
        ll a1,a2;
        if(l*(l+1) <= r)
        cout << l <<" " << l+1 << '\n';
        else if(l == 1 and r == 2)
        cout << l << " " << r << '\n';
        else if(r-l == 1)
        cout << "-1 " << "-1" << '\n';
        else
        {
            for(ll i = l;i<=r-1;i++)
            {
                for(ll j = i+1;j<=r;j++)
                {
                    if((i*j)/(__gcd(i,j)) <= r)
                    {
                        a1 = i;
                        a2 = j;
                        goto print;
                    }
                }
            }
            print :
                cout << a1 << " "  << a2 << '\n';
        }

    }
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll t;
    cin >> t;
    while(t--)
    {
        ll l,r;
        cin >> l >> r;
        ll a1 = -1,a2 = -1;
            for(ll i = l;i<=r-1;i++)
            {
                for(ll j = i+1;j<=r;j++)
                {
                    if((i*j)/(__gcd(i,j)) <= r)
                    {
                        a1 = i;
                        a2 = j;
                        goto print;
                    }
                }
            }
           print :
                cout << a1 << " "  << a2 << '\n';
        }

    }


#include<iostream>
#include<bits/stdc++.h>
#define ll int
using namespace std;
#define fastIO                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)
int main()
{
   fastIO;
    ll t;
    cin>>t;
    for(ll i=0;i<t;i++)
    {
        ll l,r,flag=0;
        cin>>l>>r;
        ll j;
        for(j=l;j<=r;j++)
        {
            if(2*j<=r)
            {
                flag=1;
                break;
            }
        }
        if(j!=0&&flag!=0)
        {
        cout<<j<<" "<<2*j<<endl;
        }
        else
        cout<<"-1 -1"<<endl;
    }
    return 0;
}


#include<iostream>
#include<bits/stdc++.h>
#define ll long long
using namespace std;
#define fastIO                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)
int main()
{
   fastIO;
    ll t;
    cin>>t;
    for(ll i=0;i<t;i++)
    {
        ll l,r,flag=0;
        cin>>l>>r;
        ll j;
        for(j=l;j<=r;j++)
        {
            if(2*j<=r)
            {
                flag=1;
                break;
            }
            else break;
        }
        if(j!=0&&flag!=0)
        {
        cout<<j<<" "<<2*j<<endl;
        }
        else
        cout<<"-1 -1"<<endl;
    }
    return 0;
}


#include<iostream>
#include<bits/stdc++.h>
#define ll long long
using namespace std;
#define fastIO                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)
int main()
{
   fastIO;
    ll t;
    cin>>t;
    for(ll i=0;i<t;i++)
    {
        ll l,r,flag=0;
        cin>>l>>r;
        ll j;
        for(j=l;j<=r;j++)
        {
            if(2*j<=r)
            {
                flag=1;
                break;
            }
        }
        if(j!=0&&flag!=0)
        {
        cout<<j<<" "<<2*j<<endl;
        }
        else
        cout<<"-1 -1"<<endl;
    }
    return 0;
}


#include<iostream>
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ll t;
    cin>>t;
    for(ll i=0;i<t;i++)
    {
        ll l,r,flag=0;
        cin>>l>>r;
        ll j;
        for(j=l;j<=r;j++)
        {
            if(2*j<=r)
            {
                flag=1;
                break;
            }
        }
        if(j!=0&&flag!=0)
        {
        cout<<j<<" "<<2*j<<endl;
        }
        else
        cout<<"-1 -1"<<endl;
    }
    return 0;
}


#include<iostream>
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ll t;
    cin>>t;
    for(ll i=0;i<t;i++)
    {
        ll l,r,flag=0;
        cin>>l>>r;
        for(ll j=l;j<=r;j++)
        {
            if(2*j<=r)
            {
                flag=1;
                break;
            }
        }
        cout<<j<<" "<<2*j<<endl;
        if(flag==0)
        cout<<"-1 -1"<<endl;
    }
    return 0;
}


#include<iostream>
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ll t;
    cin>>t;
    for(ll i=0;i<t;i++)
    {
        ll l,r,flag=0;
        cin>>l>>r;
        ll j;
        for(j=l;j<=r;j++)
        {
            if(2*j<=r)
            {
                flag=1;
                break;
            }
        }
        cout<<j<<" "<<2*j<<endl;
        if(flag==0)
        cout<<"-1 -1"<<endl;
    }
    return 0;
}


#include<iostream>
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ll t;
    cin>>t;
    for(ll i=0;i<t;i++)
    {
        ll l,r,flag=0;
        cin>>l>>r;
        for(ll j=l;j<=r;j++)
        {
            for(ll k=r;k>=j+1;k--)
            {
                if(k%j==0)
                {
                    cout<<j<<" "<<k<<endl;
                    flag=1;
                    break;
                }
                else if(j*k<=r)
                {
                    cout<<j<<" "<<k<<endl;
                    flag=1;
                    break;
                }
            }
            if(flag==1)
            break;
        }
        if(flag==0)
        cout<<"-1 -1"<<endl;
    }
    return 0;
}


#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#include <chrono>
using namespace std::chrono;
#define fl(i,z,n) for(int i=z;i<=(n);i++)
#define flr(i,z,n) for(int i=z;i>=(n);i--)
using namespace std;
#define ll long long
#define printa(a,s) fl(i,0,s-1) cout<<*(a+i)<<" "; cout<<nl;
#define printv(v) fl(i,0,v.size()-1) cout<<v[i]<<" "; cout<<nl;
#define all(v) v.begin(),v.end()
#define debnl(x) cout<<#x<<"="<<x<<nl;
#define deb(x) cout<<#x<<"="<<x<<" ";
#define mkp(x,y) make_pair(x,y)
#define read(v) fl(i,0,v.size()-1) cin>>v[i];
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
#define ump unordered_map
#define in insert
#define sz size
#define len length
#define nl '\n'
#define pb push_back
#define in insert
#define ub upper_bound
#define lb lower_bound
#define ld long double
const int MXN=1000009;
ll mod=1e9+7;

/*
PretestsPassed HELP()
    * Think ezyy
    * run 1 more test case
    * Dont see standings :D
*/
void solve(){
    ll l,r;
    cin>>l>>r;
    vll ans;
    if(l&1) ans.pb(++l);
    if(++l<=r ) ans.pb(l);
    else{
        cout<<-1<<nl;
    }
    printv(ans);
}
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    ll t=1;
    cin>>t; //comment for single test
    int c=1;
    while(t--) {    /*cout<<"Case #"<<c++<<": ";*/ solve(); }
}


#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#include <chrono>
using namespace std::chrono;
#define fl(i,z,n) for(int i=z;i<=(n);i++)
#define flr(i,z,n) for(int i=z;i>=(n);i--)
using namespace std;
#define ll long long
#define printa(a,s) fl(i,0,s-1) cout<<*(a+i)<<" "; cout<<nl;
#define printv(v) fl(i,0,v.size()-1) cout<<v[i]<<" "; cout<<nl;
#define all(v) v.begin(),v.end()
#define debnl(x) cout<<#x<<"="<<x<<nl;
#define deb(x) cout<<#x<<"="<<x<<" ";
#define mkp(x,y) make_pair(x,y)
#define read(v) fl(i,0,v.size()-1) cin>>v[i];
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
#define ump unordered_map
#define in insert
#define sz size
#define len length
#define nl '\n'
#define pb push_back
#define in insert
#define ub upper_bound
#define lb lower_bound
#define ld long double
const int MXN=1000009;
ll mod=1e9+7;

/*
PretestsPassed HELP()
    * Think ezyy
    * run 1 more test case
    * Dont see standings :D
*/
void solve(){
    ll l,r;
    cin>>l>>r;
    vll ans;
    if(l&1) ans.pb(++l);
    else ans.pb(l);
    if(++l<=r ) ans.pb(l);
    else{
        cout<<-1<<nl;
    }
    printv(ans);
}
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    ll t=1;
    cin>>t; //comment for single test
    int c=1;
    while(t--) {    /*cout<<"Case #"<<c++<<": ";*/ solve(); }
}


#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#include <chrono>
using namespace std::chrono;
#define fl(i,z,n) for(int i=z;i<=(n);i++)
#define flr(i,z,n) for(int i=z;i>=(n);i--)
using namespace std;
#define ll long long
#define printa(a,s) fl(i,0,s-1) cout<<*(a+i)<<" "; cout<<nl;
#define printv(v) fl(i,0,v.size()-1) cout<<v[i]<<" "; cout<<nl;
#define all(v) v.begin(),v.end()
#define debnl(x) cout<<#x<<"="<<x<<nl;
#define deb(x) cout<<#x<<"="<<x<<" ";
#define mkp(x,y) make_pair(x,y)
#define read(v) fl(i,0,v.size()-1) cin>>v[i];
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
#define ump unordered_map
#define in insert
#define sz size
#define len length
#define nl '\n'
#define pb push_back
#define in insert
#define ub upper_bound
#define lb lower_bound
#define ld long double
const int MXN=1000009;
ll mod=1e9+7;

/*
PretestsPassed HELP()
    * Think ezyy
    * run 1 more test case
    * Dont see standings :D
*/
void solve(){
    ll l,r;
    cin>>l>>r;
    vll ans;
    if(l==2 && r >=4){
        cout<<2<<" "<<4<<nl;return;
    }
    fl(i,l,r){
        if(ans.size()==2) break;
        if(l%2 == 0 && (l/2)%2 ==0 ) ans.pb(l);
    }
    if(ans.size()==2)
    {
        fl(i,0,ans.size()-1) cout<<ans[i]<<" ";
        cout<<nl;
    }
    else cout<<-1<<nl;
}
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    ll t=1;
    cin>>t; //comment for single test
    int c=1;
    while(t--) {    /*cout<<"Case #"<<c++<<": ";*/ solve(); }
}


#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#include <chrono>
using namespace std::chrono;
#define fl(i,z,n) for(int i=z;i<=(n);i++)
#define flr(i,z,n) for(int i=z;i>=(n);i--)
using namespace std;
#define ll long long
#define printa(a,s) fl(i,0,s-1) cout<<*(a+i)<<" "; cout<<nl;
#define printv(v) fl(i,0,v.size()-1) cout<<v[i]<<" "; cout<<nl;
#define all(v) v.begin(),v.end()
#define debnl(x) cout<<#x<<"="<<x<<nl;
#define deb(x) cout<<#x<<"="<<x<<" ";
#define mkp(x,y) make_pair(x,y)
#define read(v) fl(i,0,v.size()-1) cin>>v[i];
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
#define ump unordered_map
#define in insert
#define sz size
#define len length
#define nl '\n'
#define pb push_back
#define in insert
#define ub upper_bound
#define lb lower_bound
#define ld long double
const int MXN=1000009;
ll mod=1e9+7;

/*
PretestsPassed HELP()
    * Think ezyy
    * run 1 more test case
    * Dont see standings :D
*/
void solve(){
    ll l,r;
    cin>>l>>r;
    if(r >=2*l){
        cout<<l<<" "<<2*l<<nl;
    }else cout<<-1<<" "<<-1<<nl;
}
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    ll t=1;
    cin>>t; //comment for single test
    int c=1;
    while(t--) {    /*cout<<"Case #"<<c++<<": ";*/ solve(); }
}


#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#include <chrono>
using namespace std::chrono;
#define fl(i,z,n) for(int i=z;i<=(n);i++)
#define flr(i,z,n) for(int i=z;i>=(n);i--)
using namespace std;
#define ll long long
#define printa(a,s) fl(i,0,s-1) cout<<*(a+i)<<" "; cout<<nl;
#define printv(v) fl(i,0,v.size()-1) cout<<v[i]<<" "; cout<<nl;
#define all(v) v.begin(),v.end()
#define debnl(x) cout<<#x<<"="<<x<<nl;
#define deb(x) cout<<#x<<"="<<x<<" ";
#define mkp(x,y) make_pair(x,y)
#define read(v) fl(i,0,v.size()-1) cin>>v[i];
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
#define ump unordered_map
#define in insert
#define sz size
#define len length
#define nl '\n'
#define pb push_back
#define in insert
#define ub upper_bound
#define lb lower_bound
#define ld long double
const int MXN=1000009;
ll mod=1e9+7;

/*
PretestsPassed HELP()
    * Think ezyy
    * run 1 more test case
    * Dont see standings :D
*/
void solve(){
    ll l,r;
    cin>>l>>r;
    vll ans;
    if(l&1) ans.pb(++l);
    else ans.pb(l);
    if(++l<r ) ans.pb(++l);
    else{
        cout<<-1<<nl;
    }
    printv(ans);
}
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    ll t=1;
    cin>>t; //comment for single test
    int c=1;
    while(t--) {    /*cout<<"Case #"<<c++<<": ";*/ solve(); }
}


#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#include <chrono>
using namespace std::chrono;
#define fl(i,z,n) for(int i=z;i<=(n);i++)
#define flr(i,z,n) for(int i=z;i>=(n);i--)
using namespace std;
#define ll long long
#define printa(a,s) fl(i,0,s-1) cout<<*(a+i)<<" "; cout<<nl;
#define printv(v) fl(i,0,v.size()-1) cout<<v[i]<<" "; cout<<nl;
#define all(v) v.begin(),v.end()
#define debnl(x) cout<<#x<<"="<<x<<nl;
#define deb(x) cout<<#x<<"="<<x<<" ";
#define mkp(x,y) make_pair(x,y)
#define read(v) fl(i,0,v.size()-1) cin>>v[i];
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
#define ump unordered_map
#define in insert
#define sz size
#define len length
#define nl '\n'
#define pb push_back
#define in insert
#define ub upper_bound
#define lb lower_bound
#define ld long double
const int MXN=1000009;
ll mod=1e9+7;

/*
PretestsPassed HELP()
    * Think ezyy
    * run 1 more test case
    * Dont see standings :D
*/
void solve(){
    ll l,r;
    cin>>l>>r;
    vll ans;
    if(l&1) ans.pb(++l);
    else ans.pb(l);
    if(++l<r ) ans.pb(++l);
    else{
        cout<<-1<<nl; return;
    }
    printv(ans);
}
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    ll t=1;
    cin>>t; //comment for single test
    int c=1;
    while(t--) {    /*cout<<"Case #"<<c++<<": ";*/ solve(); }
}


#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#include <chrono>
using namespace std::chrono;
#define fl(i,z,n) for(int i=z;i<=(n);i++)
#define flr(i,z,n) for(int i=z;i>=(n);i--)
using namespace std;
#define ll long long
#define printa(a,s) fl(i,0,s-1) cout<<*(a+i)<<" "; cout<<nl;
#define printv(v) fl(i,0,v.size()-1) cout<<v[i]<<" "; cout<<nl;
#define all(v) v.begin(),v.end()
#define debnl(x) cout<<#x<<"="<<x<<nl;
#define deb(x) cout<<#x<<"="<<x<<" ";
#define mkp(x,y) make_pair(x,y)
#define read(v) fl(i,0,v.size()-1) cin>>v[i];
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
#define ump unordered_map
#define in insert
#define sz size
#define len length
#define nl '\n'
#define pb push_back
#define in insert
#define ub upper_bound
#define lb lower_bound
#define ld long double
const int MXN=1000009;
ll mod=1e9+7;

/*
PretestsPassed HELP()
    * Think ezyy
    * run 1 more test case
    * Dont see standings :D
*/
void solve(){
    ll l,r;
    cin>>l>>r;
    if(r >=2*l){
        cout<<l<<" "<<2*l<<nl;
    }else cout<<-1<<nl;
}
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    ll t=1;
    cin>>t; //comment for single test
    int c=1;
    while(t--) {    /*cout<<"Case #"<<c++<<": ";*/ solve(); }
}


#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#include <chrono>
using namespace std::chrono;
#define fl(i,z,n) for(int i=z;i<=(n);i++)
#define flr(i,z,n) for(int i=z;i>=(n);i--)
using namespace std;
#define ll long long
#define printa(a,s) fl(i,0,s-1) cout<<*(a+i)<<" "; cout<<nl;
#define printv(v) fl(i,0,v.size()-1) cout<<v[i]<<" "; cout<<nl;
#define all(v) v.begin(),v.end()
#define debnl(x) cout<<#x<<"="<<x<<nl;
#define deb(x) cout<<#x<<"="<<x<<" ";
#define mkp(x,y) make_pair(x,y)
#define read(v) fl(i,0,v.size()-1) cin>>v[i];
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
#define ump unordered_map
#define in insert
#define sz size
#define len length
#define nl '\n'
#define pb push_back
#define in insert
#define ub upper_bound
#define lb lower_bound
#define ld long double
const int MXN=1000009;
ll mod=1e9+7;

/*
PretestsPassed HELP()
    * Think ezyy
    * run 1 more test case
    * Dont see standings :D
*/
void solve(){
    ll l,r;
    cin>>l>>r;
    vll ans;
    if(l==2 && r >=4){
        cout<<2<<" "<<4<<nl;return;
    }
    fl(i,l,r){
        if(ans.size()==2) break;
        if(i%2 == 0 && (i/2)%2 ==0 ) ans.pb(i);
    }
    if(ans.size()==2)
    {
        fl(i,0,ans.size()-1) cout<<ans[i]<<" ";
        cout<<nl;
    }
    else cout<<-1<<nl;
}
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    ll t=1;
    cin>>t; //comment for single test
    int c=1;
    while(t--) {    /*cout<<"Case #"<<c++<<": ";*/ solve(); }
}


#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#include <chrono>
using namespace std::chrono;
#define fl(i,z,n) for(int i=z;i<=(n);i++)
#define flr(i,z,n) for(int i=z;i>=(n);i--)
using namespace std;
#define ll long long
#define printa(a,s) fl(i,0,s-1) cout<<*(a+i)<<" "; cout<<nl;
#define printv(v) fl(i,0,v.size()-1) cout<<v[i]<<" "; cout<<nl;
#define all(v) v.begin(),v.end()
#define debnl(x) cout<<#x<<"="<<x<<nl;
#define deb(x) cout<<#x<<"="<<x<<" ";
#define mkp(x,y) make_pair(x,y)
#define read(v) fl(i,0,v.size()-1) cin>>v[i];
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
#define ump unordered_map
#define in insert
#define sz size
#define len length
#define nl '\n'
#define pb push_back
#define in insert
#define ub upper_bound
#define lb lower_bound
#define ld long double
const int MXN=1000009;
ll mod=1e9+7;

/*
PretestsPassed HELP()
    * Think ezyy
    * run 1 more test case
    * Dont see standings :D
*/
void solve(){
    ll l,r;
    cin>>l>>r;
    vll ans;
    if(l==2 && r >=4){
        cout<<2<<" "<<4<<nl;return;
    }
    fl(i,l,r){
        if(ans.size()==2) break;
        if(l%2 == 0 && (l/2)%2 ==0 ) ans.pb(l);
    }
    if(ans.size()==2) printv(ans);
    else cout<<-1<<nl;
}
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    ll t=1;
    cin>>t; //comment for single test
    int c=1;
    while(t--) {    /*cout<<"Case #"<<c++<<": ";*/ solve(); }
}


#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#include <chrono>
using namespace std::chrono;
#define fl(i,z,n) for(int i=z;i<=(n);i++)
#define flr(i,z,n) for(int i=z;i>=(n);i--)
using namespace std;
#define ll long long
#define printa(a,s) fl(i,0,s-1) cout<<*(a+i)<<" "; cout<<nl;
#define printv(v) fl(i,0,v.size()-1) cout<<v[i]<<" "; cout<<nl;
#define all(v) v.begin(),v.end()
#define debnl(x) cout<<#x<<"="<<x<<nl;
#define deb(x) cout<<#x<<"="<<x<<" ";
#define mkp(x,y) make_pair(x,y)
#define read(v) fl(i,0,v.size()-1) cin>>v[i];
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
#define ump unordered_map
#define in insert
#define sz size
#define len length
#define nl '\n'
#define pb push_back
#define in insert
#define ub upper_bound
#define lb lower_bound
#define ld long double
const int MXN=1000009;
ll mod=1e9+7;

/*
PretestsPassed HELP()
    * Think ezyy
    * run 1 more test case
    * Dont see standings :D
*/
void solve(){
    ll l,r;
    if(r >=2*l){
        cout<<l<<" "<<2*l<<nl;
    }else cout<<-1<<nl;
}
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    ll t=1;
    cin>>t; //comment for single test
    int c=1;
    while(t--) {    /*cout<<"Case #"<<c++<<": ";*/ solve(); }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int tc;
    cin>>tc;
    for(int i=0;i<tc;i++)
    {
        int l,r;
        cin>>l>>r;
        if(abs(l-r)<=1)
        {
            cout<<-1<<" "<<-1<<endl;
        }else{
            cout<<1<<" "<<l+abs((l-r)/2)<<endl;
        }

    }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int tc;
    cin>>tc;
    for(int i=0;i<tc;i++)
    {
        int l,r;
        cin>>l>>r;
        if(abs(l-r)<=1)
        {
            cout<<-1<<" "<<-1<<endl;
        }else{
            cout<<l<<" "<<(l+(l-r)/2)<<endl;
        }

    }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int tc;
    cin>>tc;
    for(int i=0;i<tc;i++)
    {
        int l,r;
        cin>>l>>r;
        if(abs(l-r)<=1)
        {
            cout<<-1<<" "<<-1<<endl;
        }else{
            cout<<l<<" "<<l*2<<endl;
        }

    }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int tc;
    cin>>tc;
    for(int i=0;i<tc;i++)
    {
        int l,r;
        cin>>l>>r;
        if(abs(l-r)<=1)
        {
            cout<<-1<<-1<<endl;
        }else{
            cout<<1<<" "<<l+1<<endl;
        }

    }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int tc;
    cin>>tc;
    for(int i=0;i<tc;i++)
    {
        int l,r;
        cin>>l>>r;
        if(abs(l-r)<=1)
        {
            cout<<-1<<" "<<-1<<endl;
        }else{
            cout<<l<<" "<<l+abs((l-r)/2)<<endl;
        }

    }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int l,r;
    int tc;
    cin>>tc;
    for(int i=0;i<tc;i++)
    {
        scanf("%d",&l);
        scanf("%d",&r);
        if(l==1 && r==2)
        {
        	cout<<1<<" "<<r<<endl;

        }
        if(abs(l-r)<=1)
        {
            cout<<-1<<" "<<-1<<endl;
            continue;
        }else{
            cout<<l<<" "<<l*2<<endl;

        }
    }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int l,r;
    int tc;
    cin>>tc;
    for(int i=0;i<tc;i++)
    {

        scanf("%d",&l);
        scanf("%d",&r);
        if(abs(l-r)<=1)
        {
            cout<<-1<<" "<<-1<<endl;
            continue;
        }else{
            cout<<l<<" "<<l*2<<endl;

        }
    }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int l,r;
    int tc;
    cin>>tc;
    for(int i=0;i<tc;i++)
    {
        scanf("%d",&l);
        scanf("%d",&r);
        if(l==1 && r==2)
        {
        	cout<<1<<" "<<r<<endl;
        	continue;

        }
        if(abs(l-r)<=1)
        {
            cout<<-1<<" "<<-1<<endl;
            continue;
        }else{
            cout<<l<<" "<<l*2<<endl;

        }
    }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int l,r;
    int tc;
    cin>>tc;
    for(int i=0;i<tc;i++)
    {
        scanf("%d",&l);
        scanf("%d",&r);
    	if(r>2*l)
    	{
    		cout<<-1<<" "<<-1<<endl;
    		continue;
    	}
        else{
            cout<<l<<" "<<(l*2)<<endl;

        }
    }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int tc;
    cin>>tc;
    for(int i=0;i<tc;i++)
    {
        int l,r;
        if(abs(l-r)<=1)
        {
            cout<<-1<<" "<<-1<<endl;
        }
        else{
            cout<<1<<" "<<l+1<<endl;
        }

    }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int l,r;
    int tc;
    cin>>tc;
    for(int i=0;i<tc;i++)
    {
        scanf("%d",&l);
        scanf("%d",&r);
    	if(r<2*l)
    	{
    		cout<<-1<<" "<<-1<<endl;
    		continue;
    	}
        else{
            cout<<l<<" "<<(l*2)<<endl;

        }
    }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int tc;
    cin>>tc;
    for(int i=0;i<tc;i++)
    {
        int l,r;
        cin>>l>>r;
        if(abs(l-r)<=1)
        {
            cout<<-1<<" "<<-1<<endl;
            continue;
        }else{
            cout<<l<<" "<<l*2<<endl;

    }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int tc;
    cin>>tc;
    for(int i=0;i<tc;i++)
    {
        int l,r;
        cin>>l>>r;
        if(abs(l-r)<=1)
        {
            cout<<-1<<-1<<endl;
        }else{
            cout<<l<<" "<<l*2<<endl;
        }

    }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int tc;
    cin>>tc;
    for(int i=0;i<tc;i++)
    {
        int l,r;
        cin>>l>>r;
        if(abs(l-r)<=1)
        {
            cout<<-1<<-1<<endl;
        }else{
            cout<<l<<" "<<l+1<<endl;
        }

    }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int l,r;
    int tc;
    cin>>tc;
    for(int i=0;i<tc;i++)
    {

        scanf("%d",&l);
        scanf("%d",&r);
        if(abs(l-r)<=1)
        {
            cout<<-1<<" "<<-1<<endl;
            continue;
        }else{
            cout<<l<<" "<<l*2<<endl;

    }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int tc;
    cin>>tc;
    for(int i=0;i<tc;i++)
    {
        int l,r;
        cin>>l>>r;
        if(abs(l-r)<=1)
        {
            cout<<-1<<" "<<-1<<endl;
            continue;
        }else{
            cout<<l<<" "<<l*2<<endl;

        }

    }
}


#include<bits/stdc++.h>
using namespace std;

int lcm(int a,int b)
{
    int m,n;

    m=a;
    n=b;

    while(m!=n)
    {
        if(m < n)
        {
        m=m+a;
        }
        else
        {
            n=n+b;
            }
    }
    return m;
}
int main()
{
    int t;
    cin>>t;
    for(int j=0;j<t;j++)
    {
        int l,r;
        cin>>l>>r;
        int l1=0;
     for(int i=l;i<=r;i++)
     {
         if(l1==1)
         {
             break;
         }
         for(int j=i+1;j<=r;j++)
         {
             int x1=i;
             int x2=j;
             int x3=lcm(x1,x2);
            //  cout<<x3<<" ";
             if(x3>=l && x3<=r)
             {
                 cout<<x1<<" "<<x2<<endl;
                 l1=1;
                 break;
             }
         }
     }
     if(l1==0)
     {
         cout<<-1<<" "<<-1<<endl;
     }

    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int t;
    cin>>t;
    for(int test=0;test<t;test++)
    {
        int l,r;
        cin>>l>>r;
        if(l*2<=r)
        {
            cout<<l<<" "<<l*2<<endl;
            continue;
        }

        else
        {
            cout<<-1<<" "<<-1<<endl;
        }

    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int lcm(int a,int b)
{
    int m,n;

    m=a;
    n=b;

    while(m!=n)
    {
        if(m < n)
        {
        m=m+a;
        }
        else
        {
            n=n+b;
            }
    }
    return m;
}
int main()
{
    int t;
    cin>>t;
    for(int test=0;test<t;test++)
    {
        int l,r;
        cin>>l>>r;
        int l1=0;
        if(l*(l+1)<=r)
        {
            cout<<l<<" "<<l+1<<endl;
            continue;
        }
     for(int i=l;i<=r;i++)
     {
         if(l1==1)
         {
             break;
         }
         for(int j=i+1;j<=r;j++)
         {
             int x1=i;
             int x2=j;
             int x3=lcm(x1,x2);
            //  cout<<x3<<" ";
             if(x3>=l && x3<=r)
             {
                 cout<<x1<<" "<<x2<<endl;
                 l1=1;
                 break;
             }
         }
     }
     if(l1==0)
     {
         cout<<-1<<" "<<-1<<endl;
     }

    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int t;
    cin>>t;
    for(int test=0;test<t;test++)
    {
        int l,r;
        cin>>l>>r;
        if(l%2==0 && l*2<=r)
        {
            cout<<l<<" "<<l*2<<endl;
        }
        else if(l%2!=0&&((l+1)/2)*3<=r)
        {
            cout<<l+1<<" "<<((l+1)/2)*3<<endl;
        }
        else
        {
            cout<<-1<<" "<<-1<<endl;
        }

    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int t;
    cin>>t;
    for(int test=0;test<t;test++)
    {
        int l,r;
        cin>>l>>r;
        int l1=0;
        for(int i=l;i<=r;i++)
        {
            if(i*2<=r)
            {
                cout<<i<<" "<<i*2<<endl;
                l1=1;
                break;
            }
        }
        if(l1==0)
        {
            cout<<-1<<" "<<-1<<endl;
        }

    }

    return 0;
}


#include<bits/stdc++.h>
#include <boost/math/common_factor.hpp>
using namespace std;
int main()
{
    int t;
    cin>>t;
    for(int j=0;j<t;j++)
    {
        int l,r;
        cin>>l>>r;
        int l1=0;
     for(int i=l;i<=r;i++)
     {
         if(l1==1)
         {
             break;
         }
         for(int j=i+1;j<=r;j++)
         {
             int x1=i;
             int x2=j;
             int x3=boost::math::lcm(x1,x2);
            //  cout<<x3<<" ";
             if(x3>=l && x3<=r)
             {
                 cout<<x1<<" "<<x2<<endl;
                 l1=1;
                 break;
             }
         }
     }
     if(l1==0)
     {
         cout<<-1<<" "<<-1<<endl;
     }

    }

    return 0;
}


#include <iostream>
#include <vector>
using namespace std;
int LCM(int n1, int n2){
	int hcf, temp,lcm;
	hcf = n1;
	temp = n2;

	while (hcf != temp)
	{
		if (hcf > temp)
			hcf -= temp;
		else
			temp -= hcf;
	}

	lcm = (n1 * n2) / hcf;

	return lcm;
}

int main()
{
	int t;
	cin >> t;
	while (t){
		int n1, n2;

		cin >> n1 >> n2;
		for (int i = n1; i <= n2 - 1; i++){
			for (int j = i + 1; j <= n2; j++){
				if (j%i != 0 && i + j >= n2)continue;
				if (LCM(i, j)<=n2){
					cout << i << " " << j;
					goto here;

				}
			}
		}
		cout << -1 << " " << -1;
	here: cout << endl;

		t--;
	}
	//system("pause");
	return 0;
}


// Example program
#include <iostream>
#include <string>
using namespace std;

int main()
{
    int t;
    cin>>t;
    while(t){
     int x,y;
     cin>>x>>y;
     if(2*x<=y)cout<<x<<" "<<2*x<<endl;
     else cout<<-1<<" "<<-1<<endl;

     t--;
    }
    return 0;
}


#include <iostream>
#include <vector>
using namespace std;
int lcm(int n1, int n2){
	//int max;
	//max = (n1 > n2) ? n1 : n2;

	//do
	//{
	//	if (max % n1 == 0 && max % n2 == 0)
	//	{

	//		return max;
	//	}
	//	else
	//		++max;
	//} while (true);
	int hcf, temp,lcm;
	hcf = n1;
	temp = n2;

	while (hcf != temp)
	{
		if (hcf > temp)
			hcf -= temp;
		else
			temp -= hcf;
	}

	lcm = (n1 * n2) / hcf;

	return lcm;
}

int main()
{
	int t;
	cin >> t;
	while (t){
		int n1, n2,max;

		cin >> n1 >> n2;
		for (int i = n1; i <= n2 - 1; i++){
			for (int j = i + 1; j <= n2; j++){
				if (lcm(i, j)<=n2){
					cout << i << " " << j;
					goto here;

				}
			}
		}
		cout << -1 << " " << -1;
	here: cout << endl;

		t--;
	}
	//system("pause");
	return 0;
}


#include <iostream>
#include <vector>
using namespace std;
int LCM(int n1, int n2){
	int hcf, temp,lcm;
	hcf = n1;
	temp = n2;

	while (hcf != temp)
	{
		if (hcf > temp)
			hcf -= temp;
		else
			temp -= hcf;
	}

	lcm = (n1 * n2) / hcf;

	return lcm;
}

int main()
{
	int t;
	cin >> t;
	while (t){
		int n1, n2;

		cin >> n1 >> n2;
		for (int i = n1; i <= n2 - 1; i++){

			for (int j = n2; j > i; j--){
				//if (i + j >= n2&& n2%i != 0)break;
				if (j%i != 0 && i + j >= n2)continue;

				if (LCM(i, j)<=n2){

					cout << i << " " << j;

					goto here;

				}
			}
		}
		cout << -1 << " " << -1;
	here: cout << endl;

		t--;
	}
	//system("pause");
	return 0;
}


#include <iostream>
#include <vector>
using namespace std;
int lcm(int n1, int n2){
	//int max;
	//max = (n1 > n2) ? n1 : n2;

	//do
	//{
	//	if (max % n1 == 0 && max % n2 == 0)
	//	{

	//		return max;
	//	}
	//	else
	//		++max;
	//} while (true);
	int hcf, temp,lcm;
	hcf = n1;
	temp = n2;

	while (hcf != temp)
	{
		if (hcf > temp)
			hcf -= temp;
		else
			temp -= hcf;
	}

	lcm = (n1 * n2) / hcf;

	return lcm;
}

int main()
{
	int t;
	cin >> t;
	while (t){
		int n1, n2;

		cin >> n1 >> n2;
		for (int i = n1; i <= n2 - 1; i++){
			for (int j = i + 1; j <= n2; j++){
				if (n2%i != 0 && i + j >= n2)goto here1;
				if (lcm(i, j)<=n2){
					cout << i << " " << j;
					goto here;

				}
			}
		}
	here1:cout << "";
		cout << -1 << " " << -1;
	here: cout << endl;

		t--;
	}
	//system("pause");
	return 0;
}


#include <stdio.h>
#include <string>
#include <iostream>
#include <set>
#include <vector>
#include <queue>
#include <iomanip>
#include <map>
#include <deque>
#define mp make_pair
#define pb push_back
#define pii pair <int, int>
#define all(a) a.begin(), a.end()
#define rt return
using namespace std;

const int max_size = 1e6, INF = 1e9 + 10, mod = 1e9 + 7;
const double eps = 1e-7;

int n;
double m;
vector <double> a, b;

bool check(double now){
	for(int i = 0; i < n - 1; i++){
		now -= (now + m) / a[i];
		if(now < 0)
			rt false;
		now -= (now + m) / b[i + 1];
		if(now < 0)
			rt false;
	}
	now -= (now + m) / a[n-1];
		if(now < 0)
			rt false;
		now -= (now + m) / b[0];
		if(now < 0)
			rt false;

	rt true;
}
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> n >> m;
	for(int i = 0; i < n; i++){
		double buff;
		cin >> buff;
		a.push_back(buff);
	}

	for(int i = 0; i < n; i++){
		double buff;
		cin >> buff;
		b.push_back(buff);
	}

	double l = 0, r = 1e9 + 5;

	for(int i = 0; i < 100000; i++){
		double m = (l + r) / 2;
		if(check(m))
			r = m;
		else
			l = m;
	}

	if(check(l))
		cout << fixed << std::setprecision(12) << l;
	else if(check(r))
		cout <<  fixed << std::setprecision(12)<< r;
	else
		cout <<  fixed << std::setprecision(12)<< -1;

	rt 0;
}


#include <stdio.h>
#include <string>
#include <iostream>
#include <set>
#include <vector>
#include <queue>
#include <iomanip>
#include <map>
#include <deque>
#define mp make_pair
#define pb push_back
#define pii pair <int, int>
#define all(a) a.begin(), a.end()
#define rt return
using namespace std;

const int max_size = 1e6, INF = 1e9 + 10, mod = 1e9 + 7;
const double eps = 1e-7;

int n;
double m;
vector <double> a, b;

bool check(double now){
	for(int i = 0; i < n - 1; i++){
		now -= (now + m) / a[i];
		now -= (now + m) / b[i + 1];
	}
	now -= (now + m) / a[n-1];
	now -= (now + m) / b[0];
	if(now < 0)
		rt false;

	rt true;
}
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> n >> m;
	for(int i = 0; i < n; i++){
		double buff;
		cin >> buff;
		a.push_back(buff);
	}

	for(int i = 0; i < n; i++){
		double buff;
		cin >> buff;
		b.push_back(buff);
	}

	double l = 0, r = 1e9 + 5;

	for(int i = 0; i < 10000; i++){
		double m = (l + r) / 2;
		if(check(m))
			r = m;
		else
			l = m;
	}

	if(check(l))
		cout << fixed << std::setprecision(12) << l;
	else if(check(r))
		cout <<  fixed << std::setprecision(12)<< r;
	else
		cout <<  fixed << std::setprecision(12)<< -1;

	rt 0;
}


#include <stdio.h>
#include <string>
#include <iostream>
#include <set>
#include <vector>
#include <queue>
#include <iomanip>
#include <map>
#include <deque>
#define mp make_pair
#define pb push_back
#define pii pair <int, int>
#define all(a) a.begin(), a.end()
#define rt return
using namespace std;

const int max_size = 1e6, INF = 1e9 + 10, mod = 1e9 + 7;
const double eps = 1e-7;

int n;
double m;
vector <double> a, b;

bool check(double now){
	for(int i = 0; i < n - 1; i++){
		now -= (now + m) / a[i];
		if(now < 0)
			rt false;
		now -= (now + m) / b[i + 1];
		if(now < 0)
			rt false;
	}
	now -= (now + m) / a[n-1];
		if(now < 0)
			rt false;
		now -= (now + m) / b[0];
		if(now < 0)
			rt false;

	rt true;
}
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> n >> m;
	for(int i = 0; i < n; i++){
		double buff;
		cin >> buff;
		a.push_back(buff);
	}

	for(int i = 0; i < n; i++){
		double buff;
		cin >> buff;
		b.push_back(buff);
	}

	double l = 0, r = 1e9 + 5;

	for(int i = 0; i < 10000; i++){
		double m = (l + r) / 2;
		if(check(m))
			r = m;
		else
			l = m;
	}

	if(check(l))
		cout << fixed << std::setprecision(12) << l;
	else if(check(r))
		cout <<  fixed << std::setprecision(12)<< r;
	else
		cout <<  fixed << std::setprecision(12)<< -1;

	rt 0;
}


#include <stdio.h>
#include <string>
#include <iostream>
#include <set>
#include <vector>
#include <queue>
#include <map>
#include <deque>
#define mp make_pair
#define pb push_back
#define pii pair <int, int>
#define all(a) a.begin(), a.end()
#define rt return
using namespace std;

const int max_size = 1e6, INF = 1e9 + 10, mod = 1e9 + 7;
const double eps = 1e-6;

int n;
double m;
vector <double> a, b;

bool check(double now){
	for(int i = 0; i < n - 1; i++){
		now -= (now + m) / a[i];
		if(now < -eps)
			rt false;
		now -= (now + m) / b[i + 1];
		if(now < -eps)
			rt false;
	}
	now -= (now + m) / a[n-1];
		if(now < -eps)
			rt false;
		now -= (now + m) / b[0];
		if(now < -eps)
			rt false;

	rt true;
}
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> n >> m;
	for(int i = 0; i < n; i++){
		double buff;
		cin >> buff;
		a.push_back(buff);
	}

	for(int i = 0; i < n; i++){
		double buff;
		cin >> buff;
		b.push_back(buff);
	}

	double l = 0, r = 10000000;

	for(int i = 0; i < 10000; i++){
		double m = (l + r) / 2;
		if(check(m))
			r = m;
		else
			l = m;
	}

	if(check(l))
		cout << l;
	else if(check(r))
		cout << r;
	else
		cout << -1;

	rt 0;
}


#include <iostream>
#include<algorithm>
#include<string>
#include<map>
#include <iterator>
#include<iomanip>
#include<vector>
#include<cmath>
#include <cstdio>
#include<queue>
#include<stack>
#include<list>
#include<stdio.h>
#include<set>
#include <functional>

#define mod 1000000007
#define mod2 30000000
#define pa(a,b) make_pair(a,b)
#define f first
#define s second
#define pb(a)  push_back(a)
#define all(a) a.begin() , a.end()
#define mem(a, b) memset(a, b, sizeof(a))
#define LL  long long int
#define oo 1e9
#define pi 3.14159265359
#define eps  1e-9

LL maxx(LL a , LL b){ return a>b ?  a : b ;}
LL minn(LL a , LL b){ return a>b ?  b : a ;}

using namespace std;
int dx[] = {1 , 1 ,1 , 0 , 0  , -1 , -1  , -1  , 0 };
int dy[] = { -1 , 0  , 1 , 1 , -1 , 0 , 1 , -1 , 0 };
void boostIO()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}
LL gcd(LL a, LL b) {
    return b == 0 ? a : gcd(b, a % b);
}
int int_gcd(int a, int b) {
    return b == 0 ? a : gcd(b, a % b);
}
LL lcm(LL a , LL b )
{
    return (a*b)/gcd(a , b);
}
LL poww(LL base, LL exp){
  base %= mod;
  LL result = 1;
  while (exp > 0) {
    if (exp & 1) result = (result * base) % mod;
    base = (base * base) % mod;
    exp >>= 1;
  }
  return result;
}
vector<double>a , b ;
int n , m ;
bool check(double w)
{
    double tot = w + m ;

    double fuel = 0 ;

    for(int i = 0 ; i < n - 1 ; i++){
        fuel = fuel + tot / a[i] ;
        tot = tot - (tot / a[i]) ;
        fuel = fuel + (tot / b[i + 1]) ;
        tot = tot - (tot / b[i + 1]) ;
    }

    fuel = fuel + tot / a.back() ;
    tot = tot - (tot / a.back()) ;
    fuel = fuel + (tot / b[0]) ;
    tot = tot - (tot / b[0]) ;

    return (fuel <= w) ;
}
int main()
{
    cin >> n >> m ;

    for(int i = 0 ; i < n ; i++){
        int x; cin >> x ;
        a.pb(x) ;
    }

    for(int i = 0 ; i < n ; i++){
        int x; cin >> x ;
        b.pb(x) ;
    }

    double l = 0 , r = 1e18 ;

    for(int i = 0 ; i <= 500 ; i++){

        double mid = (l + r) / 2 ;

        if(check(mid))
            r = mid ;
        else
            l = mid ;
    }
    if(l > 1e9){
        cout << -1 << endl ;
        return 0 ;
    }
    cout << setprecision(30) << l << endl ;
}


#define _CRT_SECURE_NO_WARNINGS

#include <vector>
#include <iostream>
#include <string>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <ctime>
#include <queue>
#include <deque>
#include <math.h>
#include <cmath>
#include <stack>
#include <algorithm>
#include <list>
#include <array>
#include <valarray>
#include <unordered_map>
#include <cassert>
#include <random>
#include <cstring>
#include <bitset>

using namespace std;

typedef long double ld;
typedef long long li;
typedef vector<li> vec;
typedef vector<vector<li>> mt;
typedef pair<int, int> pii;

#define X first
#define Y second
#define all(a) a.begin(), a.end()
#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define sz(a) int(a.size())

const double PI = 3.14159265358979323846;
const ld EPS = 1e-18l;
const int INF = 1e9 + 7;
const li LINF = 8e18 + 7;

const int N = 1e3 + 7;
ld a[N], b[N];
int n, m;

bool can(ld x) {
	forn(i, n) {
		ld need = (x + m) / a[i];

		if (x - need < EPS) {
			return false;
		}

		x -= need;
		need = (x + m) / b[i + 1];

		if (x - need < EPS) {
			return false;
		}

		x -= need;
	}

	return true;
}

int main() {
#ifdef _DEBUG
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
	cin.tie(0);
	ios_base::sync_with_stdio(0);

	cin >> n >> m;

	forn(i, n) {
		cin >> a[i];
	}
	forn(i, n) {
		cin >> b[i];
	}
	a[n] = a[0];
	b[n] = b[0];

	ld l = 0, r = 1e9;
	bool f = false;
	forn(i, 200) {
		ld x = (l + r) / 2;
		if (can(x)) {
			f = true;
			r = x;
		}
		else {
			l = x;
		}
	}

	ld ans = (l + r) / 2;
	if (f && ans <= EPS + 1e9) {
		cout << fixed << setprecision(12) << ans;
	}
	else {
		cout << -1;
	}
	cout << endl;

}


#define _CRT_SECURE_NO_WARNINGS

#include <vector>
#include <iostream>
#include <string>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <ctime>
#include <queue>
#include <deque>
#include <math.h>
#include <cmath>
#include <stack>
#include <algorithm>
#include <list>
#include <array>
#include <valarray>
#include <unordered_map>
#include <cassert>
#include <random>
#include <cstring>
#include <bitset>

using namespace std;

typedef long double ld;
typedef long long li;
typedef vector<li> vec;
typedef vector<vector<li>> mt;
typedef pair<int, int> pii;

#define X first
#define Y second
#define all(a) a.begin(), a.end()
#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define sz(a) int(a.size())

const double PI = 3.14159265358979323846;
const ld EPS = 1e-9l;
const int INF = 1e9 + 7;
const li LINF = 8e18 + 7;

const int N = 1e3 + 7;
int a[N], b[N];
int n, m;

bool can(ld x) {
	forn(i, n) {
		ld need = (x + m) / a[i];

		if (x - need < EPS) {
			return false;
		}

		x -= need;
		need = (x + m) / b[i + 1];

		if (x - need < EPS) {
			return false;
		}

		x -= need;
	}

	return true;
}

int main() {
#ifdef _DEBUG
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
	cin.tie(0);
	ios_base::sync_with_stdio(0);

	cin >> n >> m;

	forn(i, n) {
		cin >> a[i];

		if (a[i] == 1) {
			cout << -1 << endl;
			return false;
		}
	}
	forn(i, n) {
		cin >> b[i];

		if (b[i] == 1) {
			cout << -1 << endl;
			return false;
		}
	}
	a[n] = a[0];
	b[n] = b[0];

	ld l = 0, r = 1e9;
	forn(i, 100) {
		ld x = (l + r) / 2;
		if (can(x)) {
			r = x;
		}
		else {
			l = x;
		}
	}

	cout << setprecision(20) << (l + r) / 2 << endl;
}


#define _CRT_SECURE_NO_WARNINGS

#include <vector>
#include <iostream>
#include <string>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <ctime>
#include <queue>
#include <deque>
#include <math.h>
#include <cmath>
#include <stack>
#include <algorithm>
#include <list>
#include <array>
#include <valarray>
#include <unordered_map>
#include <cassert>
#include <random>
#include <cstring>
#include <bitset>

using namespace std;

typedef long double ld;
typedef long long li;
typedef vector<li> vec;
typedef vector<vector<li>> mt;
typedef pair<int, int> pii;

#define X first
#define Y second
#define all(a) a.begin(), a.end()
#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define sz(a) int(a.size())

const double PI = 3.14159265358979323846;
const ld EPS = 1e-18l;
const int INF = 1e9 + 7;
const li LINF = 8e18 + 7;

const int N = 1e3 + 7;
int a[N], b[N];
int n, m;

bool can(ld x) {
	forn(i, n) {
		ld need = (x + m) / a[i];

		if (x - need < EPS) {
			return false;
		}

		x -= need;
		need = (x + m) / b[i + 1];

		if (x - need < EPS) {
			return false;
		}

		x -= need;
	}

	return true;
}

int main() {
#ifdef _DEBUG
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
	cin.tie(0);
	ios_base::sync_with_stdio(0);

	cin >> n >> m;

	forn(i, n) {
		cin >> a[i];

		if (a[i] == 1) {
			cout << -1 << endl;
			return false;
		}
	}
	forn(i, n) {
		cin >> b[i];

		if (b[i] == 1) {
			cout << -1 << endl;
			return false;
		}
	}
	a[n] = a[0];
	b[n] = b[0];

	ld l = 0, r = 1e9;
	forn(i, 100) {
		ld x = (l + r) / 2;
		if (can(x)) {
			r = x;
		}
		else {
			l = x;
		}
	}

	cout << (l + r) / 2 << endl;
}


#define _CRT_SECURE_NO_WARNINGS

#include <vector>
#include <iostream>
#include <string>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <ctime>
#include <queue>
#include <deque>
#include <math.h>
#include <cmath>
#include <stack>
#include <algorithm>
#include <list>
#include <array>
#include <valarray>
#include <unordered_map>
#include <cassert>
#include <random>
#include <cstring>
#include <bitset>

using namespace std;

typedef long double ld;
typedef long long li;
typedef vector<li> vec;
typedef vector<vector<li>> mt;
typedef pair<int, int> pii;

#define X first
#define Y second
#define all(a) a.begin(), a.end()
#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define sz(a) int(a.size())

const double PI = 3.14159265358979323846;
const ld EPS = 1e-18l;
const int INF = 1e9 + 7;
const li LINF = 8e18 + 7;

const int N = 1e3 + 7;
ld a[N], b[N];
int n, m;

bool can(ld x) {
	forn(i, n) {
		ld need = (x + m) / a[i];

		if (x - need < EPS) {
			return false;
		}

		x -= need;
		need = (x + m) / b[i + 1];

		if (x - need < EPS) {
			return false;
		}

		x -= need;
	}

	return true;
}

int main() {
#ifdef _DEBUG
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
	cin.tie(0);
	ios_base::sync_with_stdio(0);

	cin >> n >> m;

	forn(i, n) {
		cin >> a[i];
	}
	forn(i, n) {
		cin >> b[i];
	}
	a[n] = a[0];
	b[n] = b[0];

	ld l = 0, r = LINF;
	bool f = false;
	forn(i, 200) {
		ld x = (l + r) / 2;
		if (can(x)) {
			f = true;
			r = x;
		}
		else {
			l = x;
		}
	}

	ld ans = (l + r) / 2;
	if (f && ans <= EPS + 1e9) {
		cout << fixed << setprecision(12) << ans;
	}
	else {
		cout << -1;
	}
	cout << endl;

}


#define _CRT_SECURE_NO_WARNINGS

#include <vector>
#include <iostream>
#include <string>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <ctime>
#include <queue>
#include <deque>
#include <math.h>
#include <cmath>
#include <stack>
#include <algorithm>
#include <list>
#include <array>
#include <valarray>
#include <unordered_map>
#include <cassert>
#include <random>
#include <cstring>
#include <bitset>

using namespace std;

typedef long double ld;
typedef long long li;
typedef vector<li> vec;
typedef vector<vector<li>> mt;
typedef pair<int, int> pii;

#define X first
#define Y second
#define all(a) a.begin(), a.end()
#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define sz(a) int(a.size())

const double PI = 3.14159265358979323846;
const ld EPS = 1e-18l;
const int INF = 1e9 + 7;
const li LINF = 8e18 + 7;

const int N = 1e3 + 7;
ld a[N], b[N];
int n, m;

bool can(ld x) {
	forn(i, n) {
		x -= (x + m) / a[i];

		if (x < -EPS) {
			return false;
		}

		x -= (x + m) / b[i + 1];

		if (x < -EPS) {
			return false;
		}
	}

	return true;
}

int main() {
#ifdef _DEBUG
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
	cin.tie(0);
	ios_base::sync_with_stdio(0);

	cin >> n >> m;

	forn(i, n) {
		cin >> a[i];
	}
	forn(i, n) {
		cin >> b[i];
	}
	a[n] = a[0];
	b[n] = b[0];

	ld l = 0, r = 1e9;
	forn(i, N) {
		ld x = (l + r) / 2;
		if (can(x)) {
			r = x;
		}
		else {
			l = x;
		}
	}

	ld ans = (l + r) / 2;

	if (can(ans)) {
		cout << fixed << setprecision(12) << ans;
	}
	else {
		cout << -1;
	}
	cout << endl;

}


#define _CRT_SECURE_NO_WARNINGS

#include <vector>
#include <iostream>
#include <string>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <ctime>
#include <queue>
#include <deque>
#include <math.h>
#include <cmath>
#include <stack>
#include <algorithm>
#include <list>
#include <array>
#include <valarray>
#include <unordered_map>
#include <cassert>
#include <random>
#include <cstring>
#include <bitset>

using namespace std;

typedef long double ld;
typedef long long li;
typedef vector<li> vec;
typedef vector<vector<li>> mt;
typedef pair<int, int> pii;

#define X first
#define Y second
#define all(a) a.begin(), a.end()
#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define sz(a) int(a.size())

const double PI = 3.14159265358979323846;
const double EPS = 1e-15;
const int INF = 1e9 + 7;
const li LINF = 8e18 + 7;

const int N = 1e3 + 7;
ld a[N], b[N];
int n, m;

bool can(ld x) {
	forn(i, n) {
		x -= (x + m) / a[i];

		if (x < -EPS) {
			return false;
		}

		x -= (x + m) / b[i + 1];

		if (x < -EPS) {
			return false;
		}
	}

	return true;
}

int main() {
#ifdef _DEBUG
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
	cin.tie(0);
	ios_base::sync_with_stdio(0);

	cin >> n >> m;

	forn(i, n) {
		cin >> a[i];
	}
	forn(i, n) {
		cin >> b[i];
	}
	a[n] = a[0];
	b[n] = b[0];

	ld l = 0, r = 1e9;
	forn(i, 200) {
		ld x = (l + r) / 2;
		if (can(x)) {
			r = x;
		}
		else {
			l = x;
		}
	}

	ld ans = (l + r) / 2;

	if (can(ans)) {
		cout << fixed << setprecision(12) << ans;
	}
	else {
		cout << -1;
	}
	cout << endl;

}


#define _CRT_SECURE_NO_WARNINGS

#include <vector>
#include <iostream>
#include <string>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <ctime>
#include <queue>
#include <deque>
#include <math.h>
#include <cmath>
#include <stack>
#include <algorithm>
#include <list>
#include <array>
#include <valarray>
#include <unordered_map>
#include <cassert>
#include <random>
#include <cstring>
#include <bitset>

using namespace std;

typedef long double ld;
typedef long long li;
typedef vector<li> vec;
typedef vector<vector<li>> mt;
typedef pair<int, int> pii;

#define X first
#define Y second
#define all(a) a.begin(), a.end()
#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define sz(a) int(a.size())

const double PI = 3.14159265358979323846;
const double EPS = 1e-15;
const int INF = 1e9 + 7;
const li LINF = 8e18 + 7;

const int N = 1e3 + 7;
ld a[N], b[N];
int n, m;

bool can(ld x) {
	forn(i, n) {
		x -= (x + m) / a[i];

		if (x < -EPS) {
			return false;
		}

		x -= (x + m) / b[i + 1];

		if (x < -EPS) {
			return false;
		}
	}

	return true;
}

int main() {
#ifdef _DEBUG
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
	cin.tie(0);
	ios_base::sync_with_stdio(0);

	cin >> n >> m;

	forn(i, n) {
		cin >> a[i];
	}
	forn(i, n) {
		cin >> b[i];
	}
	a[n] = a[0];
	b[n] = b[0];

	ld l = 0, r = INF;
	forn(i, N * 10) {
		ld x = (l + r) / 2;
		if (can(x)) {
			r = x;
		}
		else {
			l = x;
		}
	}

	ld ans = (l + r) / 2;

	if (can(ans)) {
		cout << fixed << setprecision(8) << ans;
	}
	else {
		cout << -1;
	}
	cout << endl;

}


#define _CRT_SECURE_NO_WARNINGS

#include <vector>
#include <iostream>
#include <string>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <ctime>
#include <queue>
#include <deque>
#include <math.h>
#include <cmath>
#include <stack>
#include <algorithm>
#include <list>
#include <array>
#include <valarray>
#include <unordered_map>
#include <cassert>
#include <random>
#include <cstring>
#include <bitset>

using namespace std;

typedef long double ld;
typedef long long li;
typedef vector<li> vec;
typedef vector<vector<li>> mt;
typedef pair<int, int> pii;

#define X first
#define Y second
#define all(a) a.begin(), a.end()
#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define sz(a) int(a.size())

const double PI = 3.14159265358979323846;
const ld EPS = 1e-18l;
const int INF = 1e9 + 7;
const li LINF = 8e18 + 7;

const int N = 1e3 + 7;
ld a[N], b[N];
int n, m;

bool can(ld x) {
	forn(i, n) {
		ld need = (x + m) / a[i];

		if (x - need < EPS) {
			return false;
		}

		x -= need;
		need = (x + m) / b[i + 1];

		if (x - need < EPS) {
			return false;
		}

		x -= need;
	}

	return true;
}

int main() {
#ifdef _DEBUG
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
	cin.tie(0);
	ios_base::sync_with_stdio(0);

	cin >> n >> m;

	forn(i, n) {
		cin >> a[i];
	}
	forn(i, n) {
		cin >> b[i];
	}
	a[n] = a[0];
	b[n] = b[0];

	ld l = 0, r = 1e9;
	forn(i, 200) {
		ld x = (l + r) / 2;
		if (can(x)) {
			r = x;
		}
		else {
			l = x;
		}
	}

	ld ans = (l + r) / 2;
	if (ans <= EPS + 1e9) {
		cout << fixed << setprecision(12) << ans;
	}
	else {
		cout << -1;
	}
	cout << endl;

}


#define _CRT_SECURE_NO_WARNINGS

#include <vector>
#include <iostream>
#include <string>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <ctime>
#include <queue>
#include <deque>
#include <math.h>
#include <cmath>
#include <stack>
#include <algorithm>
#include <list>
#include <array>
#include <valarray>
#include <unordered_map>
#include <cassert>
#include <random>
#include <cstring>
#include <bitset>

using namespace std;

typedef long double ld;
typedef long long li;
typedef vector<li> vec;
typedef vector<vector<li>> mt;
typedef pair<int, int> pii;

#define X first
#define Y second
#define all(a) a.begin(), a.end()
#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define sz(a) int(a.size())

const double PI = 3.14159265358979323846;
const double EPS = 1e-9;
const int INF = 1e9 + 7;
const li LINF = 8e18 + 7;

const int N = 1e3 + 7;
int a[N], b[N];
int n, m;

bool can(ld x) {
	forn(i, n) {
		x -= (x + m) / a[i];

		if (x < -EPS) {
			return false;
		}

		x -= (x + m) / b[i + 1];

		if (x < -EPS) {
			return false;
		}
	}

	return true;
}

int main() {
#ifdef _DEBUG
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
	cin.tie(0);
	ios_base::sync_with_stdio(0);

	cin >> n >> m;

	forn(i, n) {
		cin >> a[i];
	}
	forn(i, n) {
		cin >> b[i];
	}
	a[n] = a[0];
	b[n] = b[0];

	ld l = 0, r = INF;
	forn(i, N * 10) {
		ld x = (l + r) / 2;
		if (can(x)) {
			r = x;
		}
		else {
			l = x;
		}
	}

	ld ans = (l + r) / 2;

	if (can(ans)) {
		cout << fixed << setprecision(8) << ans;
	}
	else {
		cout << -1;
	}
	cout << endl;

}


#define _CRT_SECURE_NO_WARNINGS

#include <vector>
#include <iostream>
#include <string>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <ctime>
#include <queue>
#include <deque>
#include <math.h>
#include <cmath>
#include <stack>
#include <algorithm>
#include <list>
#include <array>
#include <valarray>
#include <unordered_map>
#include <cassert>
#include <random>
#include <cstring>
#include <bitset>

using namespace std;

typedef long double ld;
typedef long long li;
typedef vector<li> vec;
typedef vector<vector<li>> mt;
typedef pair<int, int> pii;

#define X first
#define Y second
#define all(a) a.begin(), a.end()
#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define sz(a) int(a.size())

const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1e9 + 7;
const li LINF = 8e18 + 7;

const int N = 1e3 + 7;
ld a[N], b[N];
int n, m;

bool can(ld x) {
	forn(i, n) {
		x -= (x + m) / a[i];

		if (x < -EPS) {
			return false;
		}

		x -= (x + m) / b[i + 1];

		if (x < -EPS) {
			return false;
		}
	}

	return true;
}

int main() {
#ifdef _DEBUG
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
	cin.tie(0);
	ios_base::sync_with_stdio(0);

	cin >> n >> m;

	forn(i, n) {
		cin >> a[i];
	}
	forn(i, n) {
		cin >> b[i];
	}
	a[n] = a[0];
	b[n] = b[0];

	ld l = 0, r = INF;
	forn(i, N) {
		ld x = (l + r) / 2;
		if (can(x)) {
			r = x;
		}
		else {
			l = x;
		}
	}

	ld ans = (l + r) / 2;

	if (can(ans)) {
		cout << fixed << setprecision(8) << ans;
	}
	else {
		cout << -1;
	}
	cout << endl;

}


#define _CRT_SECURE_NO_WARNINGS

#include <vector>
#include <iostream>
#include <string>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <ctime>
#include <queue>
#include <deque>
#include <math.h>
#include <cmath>
#include <stack>
#include <algorithm>
#include <list>
#include <array>
#include <valarray>
#include <unordered_map>
#include <cassert>
#include <random>
#include <cstring>
#include <bitset>

using namespace std;

typedef long double ld;
typedef long long li;
typedef vector<li> vec;
typedef vector<vector<li>> mt;
typedef pair<int, int> pii;

#define X first
#define Y second
#define all(a) a.begin(), a.end()
#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define sz(a) int(a.size())

const double PI = 3.14159265358979323846;
const ld EPS = 1e-18l;
const int INF = 1e9 + 7;
const li LINF = 8e18 + 7;

const int N = 1e3 + 7;
ld a[N], b[N];
int n, m;

bool can(ld x) {
	forn(i, n) {
		ld need = (x + m) / a[i];

		if (x - need < EPS) {
			return false;
		}

		x -= need;
		need = (x + m) / b[i + 1];

		if (x - need < EPS) {
			return false;
		}

		x -= need;
	}

	return true;
}

int main() {
#ifdef _DEBUG
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
	cin.tie(0);
	ios_base::sync_with_stdio(0);

	cin >> n >> m;

	forn(i, n) {
		cin >> a[i];
	}
	forn(i, n) {
		cin >> b[i];
	}
	a[n] = a[0];
	b[n] = b[0];

	ld l = 0, r = INF;
	bool f = false;
	forn(i, 200) {
		ld x = (l + r) / 2;
		if (can(x)) {
			f = true;
			r = x;
		}
		else {
			l = x;
		}
	}

	ld ans = (l + r) / 2;
	if (f && ans <= EPS + 1e9) {
		cout << fixed << setprecision(12) << ans;
	}
	else {
		cout << -1;
	}
	cout << endl;

}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstring>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>

using namespace std;

typedef long long ll;

const double PI = acos(-1.0);
const double eps = 1e-6;
const int INF = 0x3f3f3f3f;
const int N = 2e5 + 5;
int fly[1050];
int load[1050];
int main() {
	int n;
	int start;
	while (cin >> n) {
		bool flag = true;
		cin >> start;
		double now=start;
		for (int i(0); i < n; i++) {
			cin >> fly[i];
		}
		for (int i(0); i < n; i++) {
			cin >> load[i];
		}
		for (int i(0); i < n; i++) {
			if (load[i] == 1 || fly[n - i - 1] == 1) {
				flag = false;
				break;
			}
			now += (now / (load[i] - 1));
			now += (now / (fly[n - i - 1] - 1));
		}
		if(flag)
		cout << now - start << endl;
		else cout << -1 << endl;
	}
	return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstring>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>

using namespace std;

typedef long long ll;

const double PI = acos(-1.0);
const double eps = 1e-6;
const int INF = 0x3f3f3f3f;
const int N = 2e5 + 5;
int fly[1050];
int load[1050];
int main() {
	int n;
	int start;
	while (cin >> n) {
		bool flag = true;
		cin >> start;
		double now=start;
		for (int i(0); i < n; i++) {
			cin >> fly[i];
		}
		for (int i(0); i < n; i++) {
			cin >> load[i];
		}
		for (int i(0); i < n; i++) {
			if (load[i] == 1 || fly[n - i - 1] == 1) {
				flag = false;
				break;
			}
			now += (now / (load[i] - 1));
			now += (now / (fly[n - i - 1] - 1));
		}
		if (flag)
			printf("%.10lf\n", now);
		else cout << -1 << endl;
	}
	return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstring>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>

using namespace std;

typedef long long ll;

const double PI = acos(-1.0);
const double eps = 1e-6;
const int INF = 0x3f3f3f3f;
const int N = 2e5 + 5;
int fly[1050];
int load[1050];
int main() {
	int n;
	int start;
	while (cin >> n) {
		bool flag = true;
		cin >> start;
		double now=start;
		for (int i(0); i < n; i++) {
			cin >> fly[i];
		}
		for (int i(0); i < n; i++) {
			cin >> load[i];
		}
		for (int i(0); i < n; i++) {
			if (load[i] == 1 || fly[n - i - 1] == 1) {
				flag = false;
				break;
			}
			now += (now / (load[i] - 1));
			now += (now / (fly[n - i - 1] - 1));
		}
		if (flag)
			printf("%.10lf\n", now-start);
		else cout << -1 << endl;
	}
	return 0;
}


#include <iostream>
#include <iomanip>
#include <vector>

using namespace std;

int main() {
	int n, m;
	cin >> n >> m;
	vector<int> a(n), b(n);
	for (int i = 0; i < n; ++i)
		cin >> a[i];
	for (int i = 0; i < n; ++i)
		cin >> b[i];
	double s = m + m / (b[0] - 1.0);
	for (int i = n - 1; i > 0; --i) {
		s += s / (a[i] - 1.0);
		s += s / (b[i] - 1.0);
	}
	s += s / (a[0] - 1.0);
	cout << setprecision(7) << (s - m > 1e9 + 1 ? -1 : s - m);
	return 0;
}


#include <iostream>
#include <iomanip>
#include <vector>

using namespace std;

int main() {
	int n, m;
	cin >> n >> m;
	vector<int> a(n), b(n);
	for (int i = 0; i < n; ++i)
		cin >> a[i];
	for (int i = 0; i < n; ++i)
		cin >> b[i];
	double s = m + m / (b[0] - 1.0);
	for (int i = n - 1; i > 0; --i) {
		s += s / (a[i] - 1.0);
		s += s / (b[i] - 1.0);
	}
	s += s / (a[0] - 1.0);
	if (s - m > 1e9)
		cout << -1;
	else
		cout << fixed << setprecision(7) << s - m;
	return 0;
}


#include <iostream>
#include <iomanip>
#include <vector>

using namespace std;

int main() {
	int n, m;
	cin >> n >> m;
	vector<int> a(n), b(n);
	for (int i = 0; i < n; ++i)
		cin >> a[i];
	for (int i = 0; i < n; ++i)
		cin >> b[i];
	double s = m + m / (b[0] - 1.0);
	for (int i = n - 1; i > 0; --i) {
		s += s / (a[i] - 1.0);
		s += s / (b[i] - 1.0);
	}
	s += s / (a[0] - 1.0);
	if (s - m > 1e9 + 1)
		cout << -1;
	else
		cout << setprecision(7) << s - m;
	return 0;
}


#include <iostream>
#include <iomanip>
#include <vector>

using namespace std;

int n, m;
vector<int> a, b;

bool f(double x) {
	double s = m + x;
	s -= s / a[0];
	if (s < m)
		return false;
	for (int i = 1; i < n; ++i) {
		s -= s / b[i];
		if (s < m)
			return false;
		s -= s / a[i];
		if (s < m)
			return false;
	}
	s -= s / b[0];
	return s >= m;
}

double bs(double l, double r) {
	while (r - l > 1e-7) {
		double m = (l + r) / 2;
		if (!f(m))
			l = m;
		else
			r = m;
	}
	return (f(r) ? (l + r) / 2 : -1);
}

int main() {
	cin >> n >> m;
	a.resize(n);
	b.resize(n);
	for (int i = 0; i < n; ++i)
		cin >> a[i];
	for (int i = 0; i < n; ++i)
		cin >> b[i];
	double ans = bs(0, 1e9);
	if (ans == -1)
		cout << -1;
	else
		cout << fixed << setprecision(7) << ans;
	return 0;
}


#include <iostream>
#include <iomanip>
#include <vector>

using namespace std;

int main() {
	int n, m;
	cin >> n >> m;
	vector<int> a(n), b(n);
	for (int i = 0; i < n; ++i)
		cin >> a[i];
	for (int i = 0; i < n; ++i)
		cin >> b[i];
	double s = m + m / (b[0] - 1.0);
	for (int i = n - 1; i > 0; --i) {
		s += s / (a[i] - 1.0);
		s += s / (b[i] - 1.0);
	}
	s += s / (a[0] - 1.0);
	if (s - m > 1e9 + 1)
		cout << -1;
	else
		cout << fixed << setprecision(7) << s - m;
	return 0;
}


#include <iostream>
#include <iomanip>
#include <vector>
#include <math.h>

using namespace std;

int main() {
	int n, m;
	cin >> n >> m;
	vector<int> a(n), b(n);
	for (int i = 0; i < n; ++i)
		cin >> a[i];
	for (int i = 0; i < n; ++i)
		cin >> b[i];
	double s = m + m / (b[0] - 1.0);
	for (int i = n - 1; i > 0; --i) {
		s += s / (a[i] - 1.0);
		s += s / (b[i] - 1.0);
	}
	s += s / (a[0] - 1.0);
	if (isinf(s))
		cout << -1;
	else
		cout << fixed << setprecision(7) << s - m;
	return 0;
}


#include <algorithm>
#include <bitset>
#include <cassert>
#include <deque>
#include <queue>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <float.h>
#include <limits>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<unsigned> vu;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<pi> vp;
typedef vector<pl> vpl;
typedef vector<string> vs;
typedef set<int> si;
typedef map<int, int> mi;
typedef vector<int>::iterator vii;

int n;
double m;
vd a;
vd b;

bool can(double curr)
{
	curr += m;
	for (int i = 0; i < n; ++i)
	{
		curr -= curr / a[i];
		if (curr < m)
			return false;

		curr -= curr / b[i];
		if (curr < m)
			return false;
	}
	return true;
}

int main(int argc, char* argv[])
{
	ios::sync_with_stdio(false);

	cin >> n;

	cin >> m;

	a.resize(n);
	for (int i = 0; i < n; ++i)
		cin >> a[i];

	b.resize(n);
	for (int i = 0; i < n; ++i)
		cin >> b[i];

	double mn = 0.0;
	double mx = 1e9 + 2.0;
	double eps = 1e-7;

	while (mx - mn > eps)
	{
		double curr = (mx + mn) / 2.0;
		if (can(curr))
			mx = curr;
		else
			mn = curr;
	}

	cout << setprecision(17) << (mn > 1e9 ? -1 : mn) << endl;

	return 0;
}


#include <algorithm>
#include <bitset>
#include <cassert>
#include <deque>
#include <queue>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <float.h>
#include <limits>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<unsigned> vu;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<pi> vp;
typedef vector<pl> vpl;
typedef vector<string> vs;
typedef set<int> si;
typedef map<int, int> mi;
typedef vector<int>::iterator vii;

int n;
double m;
vd a;
vd b;

bool can(double curr)
{
	curr += m;
	for (int i = 0; i < n; ++i)
	{
		curr -= curr / a[i];
		if (curr < m)
			return false;

		curr -= curr / b[i];
		if (curr < m)
			return false;
	}
	return true;
}

int main(int argc, char* argv[])
{
	ios::sync_with_stdio(false);

	cin >> n;

	cin >> m;

	a.resize(n);
	for (int i = 0; i < n; ++i)
		cin >> a[i];

	b.resize(n);
	for (int i = 0; i < n; ++i)
		cin >> b[i];

	double mn = 0.0;
	double mx = 1e9 + 2.0;
	double eps = 1e-6;

	while (mx - mn > eps)
	{
		double curr = (mx + mn) / 2.0;
		if (can(curr))
			mx = curr;
		else
			mn = curr;
	}

	cout << setprecision(17) << (mn > 1e9 ? -1 : mn) << endl;

	return 0;
}


#include<cstdio>
#include<iostream>
using namespace std;
typedef long long ll;
int a[1000], b[1000];

int main() {
	ll n, m; scanf("%I64d%I64d", &n, &m);
	for (int i = 0; i < n; i++) scanf("%d", &a[i]);
	int c; scanf("%d", &c);
	for (int i = 0; i < n-1; i++) scanf("%d", &b[i]);
	b[n - 1] = c;
	double tot = m;
	int flag = 0;
	for (int i = n-1; i >= 0; i--) {
		if (b[i] <= 1) { flag = 1; break; }
		double tmp = tot / double(b[i] - 1);
		tot += tmp;
		if (a[i] <= 1) { flag = 1; break; }
		tmp =double( tot / (a[i] - 1));
		tot += tmp;
	}
	if (flag)printf("-1");
	else printf("%.14f\n", double(tot - m));
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
using namespace std;
int main(){
    long long n;
	double m;
	double a[1010],b[1010];
    cin>>n>>m;
    for(int i = 1;i <= n; i++) cin>>a[i];
    for(int i = 1;i <= n; i++) cin>>b[i];
    int cnt1 = 0,cnt2 = 1;
    double s[2010];
    for(int i = 1;i <= 2*n - 1; i++){
       if(i&1){
	       s[i] = a[++cnt1];
       }
       else{
       	   s[i] = b[++cnt2];
       }
    }
    s[2*n] = b[1];
    double ans = m;
    for(int i = 2*n; i >= 1; i--){
    	if(s[i] == 1.0){cout<<"-1"<<endl; return 0;}
        ans+= ans/(s[i] - 1.0);
    }
    printf("%.10lf\n",ans - m);
    return 0;
}