#include <stdio.h>

int main(void) {
	int n,m,t[128],h[128],ts,hs,i,cn,dif,yn;
	while(scanf("%d%d",&n,&m) , n != 0){
		yn = 0;
		for(i = 0;i <= 127;i++){
			t[i] = 0;h[i] = 0;
		}
		ts=0;hs=0;
		for(i = 1;i <= n;i++){
			scanf("%d",&cn);
			t[cn]++;
			ts+=cn;
		}
		for(i = 1;i <= m;i++){
			scanf("%d",&cn);
			h[cn]++;
			hs+=cn;
		}
		if((ts - hs) % 2 != 0){printf("-1\n");continue;}
		if(ts >= hs){
			dif = (ts - hs) / 2;
			for(i = 0;i + dif <= 100;i++){
				if(t[i+dif] && h[i]){
					printf("%d %d\n",i+dif,i);yn = 1;break;
				}
			}
		}
		if(ts < hs){
			dif = (hs - ts) / 2;
			for(i = 0;i + dif <= 100;i++){
				if(t[i] && h[i+dif]){
					printf("%d %d\n",i,i+dif);yn = 1;break;
				}
			}
		}
		if(yn == 0){printf("-1\n");}
	}
	return 0;
}