#include <stdio.h>
int main(){
  int n,m,i,j;
  int s_taro[100],s_hanako[100],sum_taro,sum_hanako,sum_exchange,exchange_s_taro,exchange_s_hanako,count;
  
  while(1){
    scanf("%d%d",&n,&m);
    if(n==0 && m==0)break;
    sum_taro=0;
    sum_hanako=0;
    sum_exchange=100;
    count=0;
    for(i=0;i<n;i++){
      scanf("%d",&s_taro[i]);
      sum_taro+=s_taro[i];
    }
    for(j=0;j<m;j++){
      scanf("%d",&s_hanako[j]);
      sum_hanako+=s_hanako[j];
    }

    for(i=0;i<n;i++){
      for(j=0;j<m;j++){
	sum_taro-=s_taro[i];
	sum_hanako-=s_hanako[j];
	sum_taro+=s_hanako[j];
	sum_hanako+=s_taro[i];
	if(sum_taro==sum_hanako){
	  count++;
	  if(sum_exchange>=s_taro[i]+s_hanako[j]){
	    sum_exchange=s_taro[i]+s_hanako[j];
	    exchange_s_taro=s_taro[i];
	    exchange_s_hanako=s_hanako[j];
	  }
	}
      }
    }
    if(count>0)printf("%d %d\n",exchange_s_taro,exchange_s_hanako);
    else if(count==0) printf("-1\n");
  }

  return 0;
}