#include <stdio.h>

int a_num,b_num;
int a_card[100],b_card[100];

int main(void) {
	int i,j;
	int r1,r2;
	int a_sum,b_sum;
	while(1) {
		scanf("%d%d",&a_num,&b_num);
		if(a_num==0 && b_num==0)break;
		for(i=0,a_sum=0;i<a_num;i++) {
			scanf("%d",&a_card[i]);
			a_sum+=a_card[i];
		}
		for(i=0,b_sum=0;i<b_num;i++) {
			scanf("%d",&b_card[i]);
			b_sum+=b_card[i];
		}
		r1=-1;r2=1000000;
		for(i=0;i<a_num;i++) {
			for(j=0;j<b_num;j++) {
				if(a_sum-a_card[i]+b_card[j]==b_sum-b_card[j]+a_card[i]) {
					if(a_card[i]+b_card[j]<r1+r2) {
						r1=a_card[i];
						r2=b_card[j];
					}
				}
			}
		}
		if(r1<0)puts("-1"); else printf("%d %d\n",r1,r2);
	}
	return 0;
}