#include<stdio.h>

void sorting(int x[], int first, int end){
	int t;
	int i = first;
	int j = end;
	int p = (first + end)/2;
	int pivot = x[p];

	while(1){
		while(x[i] < pivot)
			i++;
		while(x[j] > pivot)
			j--;
		if(i >= j)
			break;
		t = x[i];
		x[i] = x[j];
		x[j] = t;
		i++;
		j--;
	}
	if(first < i-1)
		sorting(x, first, i-1);
	if(j+1 < end)
		sorting(x, j+1, end);
}

int exchange(int flag, int n[], int m[], int n_num, int m_num, int dif){
	int i=0, j;
	if(dif%2 == 1)
		goto notfound;
	while(i<m_num){
		for(j=0; j<n_num; j++){
			/*printf("dif:%d n:%d m:%d\n",dif/2, j, i);*/
			if(n[j] == m[i] + dif/2)
				goto found;
			if(n[j] > m[i] + dif/2)
				break;
		}
		i++;
	}
	notfound:
	printf("-1\n");
	return 0;
	found:
	if(flag == 0)
		printf("%d %d\n", n[j], m[i]);

	else
		printf("%d %d\n", m[i], n[j]);

	return 0;
}


int main(){
	int n[100] = {0};
	int m[100] = {0};
	int n_sum, m_sum;
	int n_num, m_num, i;
	int dif;



	scanf("%d %d", &n_num, &m_num);
	while(n_num != 0){
		n_sum = 0;
		m_sum = 0;
		for(i=0; i < n_num; i++){
			scanf("%d", &n[i]);
			n_sum += n[i];
		}
		for(i=0; i<m_num; i++){
			scanf("%d", &m[i]);
			m_sum += m[i];
		}

		/**printf("%d %d\n",n_sum, m_sum);*/
		sorting(n, 0, n_num-1);
		/*for(i=0; i< n_num; i++){
			printf("%d ",n[i]);
		}
		printf("\n");*/
		sorting(m, 0, m_num-1);
		/*for(i=0; i<m_num; i++){
			printf("%d ",m[i]);
		}
		printf("\n");*/
		if(n_sum >= m_sum){
			dif = n_sum - m_sum;
			exchange(0, n, m, n_num, m_num, dif);
		}
		else{
			dif = m_sum - n_sum;
			exchange(1, m, n, m_num, n_num, dif);
		}
		scanf("%d %d", &n_num, &m_num);
	}
	return 0;
}