#include<stdio.h>

int main()
{
  int sum_taro,sum_hanako;
  int card_taro[100],card_hanako[100];
  short n,m;
  short i,j;
  int difference_sum;
  char k;
  int answer_taro,answer_hanako,answer_sum;
  short a = -1;

  while(1){
    sum_taro = 0;
    sum_hanako = 0;
    k = 0;
    scanf("%hd %hd",&n,&m);

    if(n == 0 && m == 0){
      break;
    }

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

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

    if(sum_taro >= sum_hanako){
      difference_sum = sum_taro - sum_hanako;

      for(i = 0;i < n;i++){
        for(j = 0;j < m;j++){
          if(difference_sum % 2 == 0 && difference_sum/2 == card_taro[i] - card_hanako[j]){
            if(k == 0){
              answer_sum = card_taro[i] + card_hanako[j];
              answer_taro = card_taro[i];
              answer_hanako = card_hanako[j];
              k = 1;
            }
            else{
              if(answer_sum > card_taro[i] + card_hanako[j]){
                answer_sum = card_taro[i] + card_hanako[j];
                answer_taro = card_taro[i];
                answer_hanako = card_hanako[j];
              }
            }
          }
        }
      }
    }
    else{
      difference_sum = sum_hanako - sum_taro;

      for(i = 0;i < m;i++){
        for(j = 0;j < n;j++){
          if(difference_sum % 2 == 0 && difference_sum/2 == card_hanako[i] - card_taro[j]){
            if(k == 0){
              answer_sum = card_taro[j] + card_hanako[i];
              answer_taro = card_taro[j];
              answer_hanako = card_hanako[i];
              k = 1;
            }
            else{
              if(answer_sum > card_taro[j] + card_hanako[i]){
                answer_sum = card_taro[j] + card_hanako[i];
                answer_taro = card_taro[j];
                answer_hanako = card_hanako[i];
              }
            }
          }
        }
      }
    }

    if(k == 0){
      printf("%hd\n",a);
    }
    else{
      printf("%d %d\n",answer_taro,answer_hanako);
    }
  }

  return 0;
}