#include <stdio.h>
#include <stdbool.h>

int main(void){
  int work,c,i,j,n,m,Nsum=0,Msum=0,sa,hf,ns[100]={0},ms[100]={0};
  bool Nlow=false;

  while(1){
    scanf("%d %d",&n,&m);
    if(n==0&&m==0) break;
    for(i=0;i<n;i++){
      scanf("%d",&ns[i]);
      Nsum+=ns[i];
    }
    for(i=0;i<m;i++){
      scanf("%d",&ms[i]);
      Msum+=ms[i];
    }
    if(Nsum>Msum){
      sa=Nsum-Msum;
    }else{
      sa=Msum-Nsum;
      Nlow=true;
    }
    
    for(i=0;i<n;i++){
      for(j=0;j<n-1;j++){
	if(ns[i]<ns[j]){
	  work = ns[i];
	  ns[i] = ns[j];
	  ns[j] = work;
	}
      }
    }

    for(i=0;i<m;i++){
      for(j=0;j<m-1;j++){
	if(ms[i]<ms[j]){
	  work = ms[i];
	  ms[i] = ms[j];
	  ms[j] = work;
	}
      }
    }

    if(sa>=2&&sa%2==0){
      hf=sa/2;
      while(1){//hf to 1
	if(hf==1) break;
	hf--;
	sa--;
      }
      switch(Nlow){
      case true:
	while(1){
	  for(i=0;i<n;i++){
	    if(ns[i]==hf){
	      for(j=0;j<m;j++){
		if(ms[j]==sa){
		  printf("%d %d\n",hf,sa);
		  goto RESET;
		}
	      }
	    }else if(ns[i]>hf){
	      hf++;
	      sa++;
	      break;
	    }
	    hf++;
	    sa++;
	  }
	}
	break;
      case false:
	while(1){
	  for(i=0;i<m;i++){
	    if(ms[i]==hf){
	      for(j=0;j<n;j++){
		if(ns[j]==sa){
		  printf("%d %d\n",sa,hf);
		  goto RESET;
		}
	      }
	    }else if(ns[i]>hf){
	      hf++;
	      sa++;
	      break;
	    }
	    hf++;
	    sa++;
	  }
	}
	break;
      default:break;
      }
    }else puts("-1");

  RESET:
    for(i=0;i<100;i++){
      ns[i]-=ns[i];
      ms[i]-=ms[i];
    }
    sa-=sa;
    Nlow=false;
    Nsum-=Nsum;
    Msum-=Msum;
    c-=c;
  }
  return 0;
}