#include <stdio.h>
#include <stdlib.h>

int main(void){
  int n, m, sumTaro, sumHana, i, j, diff, flag;
  int *taro, *hana;

  while(1){
    scanf("%d %d", &n, &m);
    sumTaro = sumHana = flag = 0;
    if(!n) break;

    taro = (int *)malloc((n + 1) * sizeof(int));
    hana = (int *)malloc((m + 1) * sizeof(int));

    for(i = 1; i <= n; i++){
      scanf("%d", &taro[i]);
      sumTaro += taro[i];
    }
    for(i = 1; i <= m; i++){
      scanf("%d", &hana[i]);
      sumHana += hana[i];
    }
    if(sumTaro > sumHana){
      diff = (sumTaro - sumHana) / 2;
      for(i = 1; i <= n; i++){
        for(j = 1; j <= m; j++){
          if(taro[i] - hana[j] == diff && taro[i] != 0 && hana[j] != 0){
            printf("%d %d\n", taro[i], hana[j]);
            flag = 1;
            break;
          }
        }
        if(flag) break;
        }
      }
      else if(sumTaro < sumHana){
        diff = (sumHana - sumTaro) / 2;
        for(i = 1; i <= n; i++){
          for(j = 1; j <= m; j++){
            if(hana[j] - taro[i] == diff && taro[i] != 0 && hana[j] != 0){
              printf("%d %d\n", taro[i], hana[j]);
              flag = 1;
              break;
            }
          }
          if(flag) break;
        }
      }
      else{
        for(i = 1; i <= n; i++){
          for(j = 1; j <= m; j++){
            if(taro[i] == hana[j] && taro[i] != 0 && hana[j] != 0){
              printf("%d %d\n", taro[i], hana[j]);
              flag = 1;
              break;
            }
          }
          if(flag) break;
        }
      }
      if(!flag){
        printf("-1\n");
      }
      free(taro);
      free(hana);
    }

    return 0;
  }