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

#define rep(i, n) for(int i = 0; i < n; i ++)
#define ALL(T) T.begin(), T.end()
#define mp make_pair
#define pb push_back
#define MEMSET(v, h) memset((v), h, sizeof(v))

using namespace std;

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;

const int INF = 1 << 24;

int main(void){
	int N,M;
	int Ntotal,Mtotal;
	int n[100],m[100];
	int min;
	
	while(true){
		Ntotal=0;
		Mtotal=0;
		min =INF;
		cin >> N >> M;
		if (N == M && N == 0)
			break;
		rep(i,N){
			cin >> n[i];
			Ntotal+=n[i];
		}
		rep(i,M){
			cin >> m[i];
			Mtotal+=m[i];
		}
		if(Mtotal== Ntotal){
			rep(i,N){
				rep(j,M){
					if(n[i] == m[j] && min > n[i])
						min = n[i];
				}
			}
			if(min == INF)
				cout << -1 << endl;
			else
				cout << min << ' ' << min << endl;
		}else{
			int tem1=INF,tem2=INF;
			min = Ntotal-Mtotal;
			rep(i,N){
				rep(j,M){
					if((n[i]-m[j])*2 == min && tem1+tem2 >n[i]+m[j]){
						tem1=n[i];
						tem2=m[j];
					}
				}
			}
			if(tem1==tem2)
				cout << -1 << endl;
			else
				cout <<tem1 << ' ' << tem2 <<  endl;
		}
 	}   
    return 0;
}