#include <stdio.h>
#define MAX 100

void array_clear(int a[],int n){
  int i;
  for(i=0;i<n;i++){
    a[i]=0;
  }
}

int numcheck(int a[],int x,int y,int cnt){
    int i;
    int ans;

    for(i=0;i<cnt;i++){
      ans=a[i]-x;
      if(ans < 0)ans *= -1;
      if(ans == y){
        return a[i];
      } else {
        continue;
      }
    }

    return -1;
}

int main(void){
  int taro[MAX];
  int hanako[MAX];
  int tsum,hsum,num;
  int t_h;
  int n,m;
  int i,j;
  int tans,hans;

  while(1){
    array_clear(taro,MAX);
    array_clear(hanako,MAX);

    tsum=hsum=hans=0;
    tans=-1;

    scanf("%d%d",&n,&m);
    if(n==0)break;

    for(i=0;i<n;i++){
      scanf("%d",&taro[i]);
      tsum += taro[i];
    }
    for(i=0;i<m;i++){
      scanf("%d",&hanako[i]);
      hsum += hanako[i];
    }
    t_h=(tsum-hsum)/2;
    if(t_h < 0)t_h *= -1;

    num=1;
    for(i=0;i<n;i++){
      if(taro[i] == num){
        hans=numcheck(hanako,num,t_h,m);
        if(hans != -1){
          tans = taro[i];
          break;
        } else {
          num++;
          continue;
        }
      } else if(i == n-1){
        num++;
        continue;
      } else {
        continue;
      }
    }
    if(tans!=-1){
      printf("%d %d\n",tans,hans);
    } else {
      printf("-1\n");
    }
  }


  return 0;
}