#include<stdio.h>
int main(){
  int a[100],b[100],sa,sb,mi,mj,i,j,n,m,min;
  while(scanf("%d %d",&n,&m),n||m){
    for(i=sa=0;i<n;i++){
      scanf("%d",&a[i]);
      sa+=a[i];
    }
    for(i=sb=0;i<m;i++){
      scanf("%d",&b[i]);
      sb+=b[i];
    }
    min=10000000;
    for(i=0;i<n;i++){
      for(j=0;j<m;j++){
	if(sa-a[i]+b[j]!=sb-b[j]+a[i])continue;
	if(min>a[i]+b[j])min=a[mi=i]+b[mj=j];
      }
    }
    if(min==10000000)printf("-1\n");
    else             printf("%d %d\n",a[mi],b[mj]);
  }
  return 0;
}