#include <stdio.h>
int main(void) {
  int a[100],b[100],n,m,i,j,suma,sumb,total,a1,a2;
  while(1){
  	a1=-1;
  	a2=-1;
scanf("%d%d",&n,&m);
suma=sumb=0;
if(n==0&&m==0)break;
for(i=0;i<n;i++){
	scanf("%d",&a[i]);
	suma+=a[i];
}
for(i=0;i<m;i++){
	scanf("%d",&b[i]);
	sumb+=b[i];
}
total==suma+sumb;
if(total%2==1)break;
else{
for(i=0;i<n;i++){
for(j=0;j<m;j++){
	if((suma-a[i]+b[j])==(sumb-b[j]+a[i])){
		a1=a[i];
		a2=b[j];
	}
	if(a1!=-1)break;
}if(a1!=-1)break;
}
  }
  
if(a1!=-1)printf("%d% d\n",a1,a2);
else printf("-1\n");
}
  return 0;
}