#include<iostream>
using namespace std;
int T[100];
int H[100];
int sumT,sumH;
int m,n;
int main(){
  while(cin >> n >> m && n+m != 0){
    sumT = sumH = 0;
    for(int i = 0;i < n;i++){
      cin >> T[i];
      sumT += T[i];
    }
    for(int i = 0;i < m;i++){
      cin >> H[i];
      sumH += H[i];
    }
    bool isfind = false;
    for(int i = 0;i < n && !isfind;i++){
      for(int j = 0;j < m && !isfind;j++){
	if(sumH-sumT == (H[j] - T[i])*2){
	  cout << T[i] << ' ' << H[j] << endl;
	  isfind = true;
	}
      }
    }
    if(isfind == false){
      cout << -1 << endl;
    }
  }
}