/*
AizuOnline A1153
Equal Totaol Score
*/
#include <stdio.h>
#include <limits.h>
int n=0 , m=0 ;
int taro[100];
int hanako[100];
main() 
{
  int taro_c,hanako_c,diff;
  int i,j;
  int minval;


  while(EOF != scanf(" %d",&n) &&
	EOF != scanf(" %d",&m) && (m||n)) 
    {
      taro_c=0;hanako_c=0;

      for(i=0;i<n;i++)
	scanf(" %d",&(taro[i]));
      for(i=0;i<m;i++)
	scanf(" %d",&(hanako[i]));

      for(i=0;i<n;i++)
	taro_c += taro[i];
      for(i=0;i<m;i++)
	hanako_c += hanako[i];

      diff = taro_c-hanako_c;
      minval = INT_MAX;
      if(diff % 2)
	goto NA;

      for(i=0;i<n;i++)
	for(j=0;j<m;j++)
	  {
	    if(taro[i]-hanako[j] == diff/2 && taro[i] < minval)
	      minval = taro[i];
	  }

 NA:
      if(minval < INT_MAX)	  
	printf("%d %d\n",minval,minval-diff/2);
      else
	printf("-1\n");
    }

return(0);
}