
#include<stdio.h>

int main(){
  int i,j;
  int n,m;
  int s[100000];
  int rel1=0;
  int rel2=0;
  int flag=0;
  int ans1=1000,ans2,ans3;

  while(1){
    rel1=0;
    rel2=0;
    flag=0;
    ans1=1000;

    scanf("%d %d",&n,&m);

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

    for(i=0;i<n;i++){
      scanf("%d",&s[i]);
      rel1+=s[i];

    }
    for(j=n;j<m+n;j++){
      scanf("%d",&s[j]);
      rel2+=s[j];
    }




if(rel1==rel2){
      for(i=0;i<n;i++){
        for(j=n;j<m+n;j++){
          if(s[i]==s[j]&&flag==0){
            printf("%d %d\n",s[i],s[j]);
            flag=1;
          }
        }
      }
    }else{
    for(i=0;i<n;i++){
      rel1-=s[i];
      for(j=n;j<m+n;j++){
        rel2-=s[j];
        rel1+=s[j];
        rel2+=s[i];
        if(rel1==rel2){
          if(ans1>rel1){
            ans1=rel1;
            ans2=s[i];
            ans3=s[j];
          }
          flag=1;
        }else{
          rel2+=s[j];
          rel2-=s[i];
          rel1-=s[j];
        }
      }
      rel1+=s[i];
    }
    if(ans1!=1000) printf("%d %d\n",ans2,ans3);
    if(flag==0) printf("-1\n");
    }
  }
  return 0;
}