#include <stdio.h>

int main(void){

  int n,m;
  int i,j,k,l;
  int s;
  int taro[100],hanako[100];
  int t=0;

  for(;;){
    scanf("%d %d",&n,&m);
    if(n==0&&m==0)break;
    
    for(i=0;i<n;i++){
      scanf("%d",&s);
      taro[i]=s; 
    }

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

    int thsum=200;
    int tarocard=101,hanakocard=101;
  
    for(i=0;i<n;i++){
      for(j=0;j<m;j++){
        int tarosum=0,hanakosum=0;
        t=taro[i];
        taro[i]=hanako[j];
        hanako[j]=t;
        for(k=0;k<n;k++)
          tarosum+=taro[k];
        for(k=0;k<m;k++)
          hanakosum+=hanako[k];
        if(tarosum==hanakosum&&thsum>=taro[i]+hanako[j]){
          hanakocard=taro[i];
          tarocard=hanako[j];
          thsum=taro[i]+hanako[j];
        }
        t=taro[i];
        taro[i]=hanako[j];
        hanako[j]=t;
      }
    }
    if(tarocard==101||hanakocard==101)printf("-1\n");
    else printf("%d %d\n",tarocard,hanakocard);

    }

  return 0;
}