#include <iostream>
#include <vector>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
	while(1){
		int n,m; cin>>n>>m;if(n==0) return 0;
		vector<int>a,b; int x=0,y=0;
		rep(i,n){int c;cin>>c;a.push_back(c);x+=c;}
		rep(i,m){int c;cin>>c;b.push_back(c);y+=c;}
		int ans1=1e9,ans2=1e9;
		rep(i,n)rep(j,m){
			if(x-a[i]+b[j] == y-b[j]+a[i] && ans1 > a[i]){
				ans1 = a[i];
				ans2 = b[j];
			}
		}
		if(ans1 > 1e8) puts("-1");
		else cout << ans1 << " " << ans2 << endl;
	}
}

