#include <stdio.h>
#include <string.h>

int swap_and_add(int *taro,int n,int *hanako,int m,int a,int b);

int main(void){

  int n;
  int m;
  int i;
  int j=0;
  int taro_cards[101]={0};
  int hanako_cards[101]={0};
  int min_sum;
  int taro_change;
  int hanako_change;
  int check=0; 
  char counter=0;

  while(1){
  scanf("%d%d",&m,&n);
  if(m==0 && n==0){
    break;
  }

  for(i=0;i<m;i++){
    scanf("%d",&taro_cards[i]);
  }

  for(i=0;i<n;i++){
    scanf("%d",&hanako_cards[i]);
  }

  for(i=0;i<m;i++){
    for(j=0;j<n;j++){
      check=swap_and_add(taro_cards,m,hanako_cards,n,i,j);

      if(check!=0 && counter==0){
	taro_change=taro_cards[i];
	hanako_change=hanako_cards[j];
	min_sum=check;
	counter++;
      }
      else if(check!=0 &&counter!=0){
	if(min_sum >check){
	  taro_change=taro_cards[i];
	  hanako_change=hanako_cards[j];
	  min_sum=check;
	}
      }
    }
  }

  if(counter==0){
    printf("-1\n");
    return 0;
  }

  printf("%d %d\n",taro_change,hanako_change);

  }

  return 0;
}

int swap_and_add(int *taro,int m,int *hanako,int n,int i,int j){
  int temp;
  int k;
  int taro_sum=0;
  int hanako_sum=0;
  int taro_cpy[101]={0};
  int hanako_cpy[101]={0};

  for(k=0;k<m;k++){
    taro_cpy[k]=taro[k];
  }

  for(k=0;k<n;k++){
    hanako_cpy[k]=hanako[k];
  }

  temp=taro_cpy[i];
  taro_cpy[i]=hanako_cpy[j];
  hanako_cpy[j]=temp;

  for(k=0;k<m;k++){
    taro_sum+=taro_cpy[k];
  }

  for(k=0;k<n;k++){
    hanako_sum+=hanako_cpy[k];
  }

  if(taro_sum==hanako_sum){
    return taro_sum;
  }

  else{
    return 0;
  }

}