#include<stdio.h>
int main(){
  char n;
  int a,b,c[1000],d[1000],i,j,sumx,sumy,lsx[100],lsy[100],l=0,flag,ans;
  for(i=0;i<100;i++){
    lsx[i]=-1;
    lsy[i]=-1;
  }
  while(1){
    scanf("%d%d",&a,&b);
    if(a==0 && b==0)break;
    flag=0;
    sumx=0;
    sumy=0;
    for(i=0;i<a;i++){
      scanf("%d",&c[i]);
      sumx+=c[i];
    }
    for(i=0;i<b;i++){
      scanf("%d",&d[i]);
      sumy+=d[i];
    }
    ans=sumx-sumy;
    for(i=0;i<a;i++){
      for(j=0;j<b;j++){
	if((c[i]-d[j])*2==ans || (d[j]-c[i])*2==ans){
	  lsx[l]=c[i];
	  lsy[l]=d[j];
	  l++;
	  flag=1;
	  break;
	}
      }
      if(flag==1)break;
    }
    if(flag==0)
      l++;
  }
  for(i=0;i<l;i++){
    if(lsx[i]==-1 && lsy[i]==-1)
      printf("-1\n");
    else printf("%d %d\n",lsx[i],lsy[i]);
  }
  return 0;
}