#include<iostream>

using namespace std;

int sum(int[] ,int );

int main(void){

  int n,m,sub,flag,cnum1,cnum2,i,j;
  scanf("%d%d",&n,&m);
  int a[n],b[m];

  while( (n==0&&m==0) != 1 ){ 

    for(i=0;i<n;i++) scanf("%d",&a[i]);
    for(j=0;j<m;j++) scanf("%d",&b[j]);

    sub = sum(a,n) - sum(b,m);


    flag=0;
    for(i=0;i<n;i++){
      for(j=0;j<m;j++){
	if( (a[i] - b[j])*2 == sub ){
	  if(flag==0){
	    cnum1 = a[i];
	    cnum2 = b[j];
	    flag++;
	  }else{
	    if(a[i] + b[j] < cnum1 + cnum2){
	      cnum1 = a[i];
	      cnum2 = b[j];
	    }
	  }
	}
      }
    }


    if(flag==0){
      printf("-1\n");
    }else{
      printf("%d %d\n",cnum1,cnum2);
    }


    /*

sub = 2
1,3,4,8,3,1
3,1,4,5,3,2



     */

    scanf("%d%d",&n,&m);
  }
  
  return 0;
}

int sum(int a[],int n){
  int s=0,i;
  for(i=0;i<n;i++) s+=a[i];
  return s;
}
  