/*No.1153 Equal Total Scores*/
#include <stdio.h>

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

int main(void){

  int i,j;
  int m; /*???????????????????????°*/
  int n; /*??±????????????????????°*/
  int check;
  int min_sum;  
  int taro_change;
  int hanako_change;

  while(1){
    int taro_cards[101]={0};
    int hanako_cards[101]={0};

    char counter=0;

    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=trade_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");
    }
    else if(counter!=0){
      printf("%d %d\n",taro_change,hanako_change);
    }
  }
  return 0;
}

int trade_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;
  }

}