#include <stdio.h>
#

typedef struct{
	int tcard[100],hcard[100],tsum,hsum,tnum,hnum;
	int result;
	int card[2];
}SET;


int main()
{
	int k=0,i,j,diff;
	SET game[200];
	
	while(1){

		scanf("%d %d",&game[k].tnum,&game[k].hnum);
		if(game[k].tnum==0 && game[k].hnum==0){
			break;
		}
		
		for(i=0;i<game[k].tnum;i++){
			scanf("%d",&game[k].tcard[i]);
			game[k].tsum+=game[k].tcard[i];
		}
		for(i=0;i<game[k].hnum;i++){
			scanf("%d",&game[k].hcard[i]);
			game[k].hsum+=game[k].hcard[i];
		}
		if(!((game[k].tsum+game[k].hsum)%2)){
			diff=game[k].tsum-(game[k].tsum+game[k].hsum)/2;
			for(i=0;i<game[k].tnum&&game[k].result==0;i++){
				for(j=0;j<game[k].hnum;j++){
					if(diff==(game[k].tcard[i]-game[k].hcard[j])&&game[k].tcard[i]!=0&&game[k].hcard[j]!=0){
						game[k].card[0]=game[k].tcard[i];
						game[k].card[1]=game[k].hcard[j];
						game[k].result++;
						break;
					}
				}
			}
		}
		k++;
	}
	for(i=0;i<k;i++){
		//printf("%d\n",game[i].result);
		if(game[i].result==0){
			printf("-1");
		}
		else{
			printf("%d %d",game[i].card[0],game[i].card[1]);
		}
		if(i!=k-1){
			printf("\n");
		}
	}
	return 0;
}