#define _CRT_SECURE_NO_WARNINGS 
#include <stdio.h>
#include <math.h>
#define Abs(x) ((x>=0)?x:-x)

int main()
{
	while (1){
	int sumt=0, sumh=0,n,m;
	int cardt[100], cardh[100];
		scanf("%d", &n);
		scanf("%d", &m);
		if (n == m == 0){
			break;
		}
		int i = 0;
		while (i < n){
			scanf("%d", &cardt[i]);
			sumt += cardt[i];
			i++;
		}
		i = 0;
		while (i < m){
			scanf("%d", &cardh[i]);
			sumh += cardh[i];
			i++;
		}

		if ((sumt + sumh) % 2 == 1){
			printf("%d\n", -1);
		}

		int j, temp, diff, flag = 0;
		diff = abs(sumt - sumh);
		printf("sumt=%d sumh=%d diff=%d\n", sumt, sumh, diff);
		for (i = 0; i < n&&flag == 0; i++){
			for (j = 0; j < m&&flag == 0; j++){
				if (abs(cardt[i] - cardh[j]) == diff / 2){
					flag = 1;
				}
			}
		}
		if (flag == 0){
			printf("%d\n", -1);
		}
		i--;
		j--;
		temp = cardt[i];
		cardt[i] = cardh[j];
		cardh[j] = temp;
		printf("%d %d\n", cardh[j], cardt[i]);
	}
	return 0;
}