#include<stdio.h>
#include<stdlib.h>

int main() {

	int n,m;
	int *s,*t;
	int i,j,k=0;
	int sums,sumt;
	int as,at;
	int answers[100],answert[100];

	for(;;) {

		sums=0;
		sumt=0;
		as=101;
		at=101;

		scanf("%d %d",&n,&m);
		if(n==0&&m==0)
			break;
		s=(int *)malloc(n * sizeof(int));
		t=(int *)malloc(m * sizeof(int));

		for(i=0;i<n;i++) {
			scanf("%d",&s[i]);
			sums+=s[i];
		}
		for(i=0;i<m;i++) {
			scanf("%d",&t[i]);
			sumt+=t[i];
		}

		for(i=0;i<n;i++) {
			for(j=0;j<m;j++) {
				if(sums-s[i]+t[j]==sumt-t[j]+s[i]) {
					if(as+at>s[i]+t[j]) {
						as=s[i];
						at=t[j];
					}
				}
			}
		}
		if(as!=101) {
			answers[k]=as;
			answert[k]=at;
		}
		else
			answers[k]=-1;
		k++;
		free(s);
		free(t);
	}

	for(i=0;i<k;i++) {
		if(answers[i]>=0)
			printf("%d %d\n",answers[i],answert[i]);
		else
			printf("%d\n",answers[i]);
	}

	return 0;
}