#include<stdio.h>

int main(void)
{
	int n,m,i,j,temp1,temp2;
	int s[101], t[101];
	int count, ssum, tsum;
	int cht, chh, check;
	
	while(scanf("%d %d",&n,&m))
	{
		if(n==0&&m==0)
		break;
		else
		{
			ssum = 0;
			tsum = 0;
			count = 201;
			check = 0;
			for(i=0;i<n;i++){
				scanf("%d",&s[i]);
				ssum+=s[i];
			}
			for(i=0;i<m;i++){
				scanf("%d",&t[i]);
				tsum+=t[i];
			}
			for(i=0;i<n;i++)
			{
				for(j=0;j<m;j++)
				{
					temp1 = ssum-s[i];
					temp2 = tsum-t[j];
					temp1+=t[j];
					temp2+=s[i];
					if(temp1==temp2&&count>s[i]+t[j])
					{
						count=s[i]+t[j];
						cht = s[i];
						chh = t[j];
						check = 1;
					}
				}
			}
			if(check==0)
			printf("-1\n");
			else
			printf("%d %d\n",cht,chh);
		}
	}
	return 0;
}