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

int N[50];
int M[50];
int comp(const void *c1, const void *c2){
    int *a = (int *)c1;
    int *b = (int *)c2;
    return *a-*b;
}


int main(void){
    int n,n_sum,m,m_sum,i,j;
    while(scanf("%d %d", &n, &m),n||m){
        n_sum=0;
        for(i=0;i<n;i++){
            scanf("%d", &N[i]);
            n_sum+=N[i];
        }
        qsort(N,n,sizeof(int),comp);
        //for(i=0;i<n;i++) printf("N[%d]:%d\n",i,N[i]);
        m_sum=0;
        for(i=0;i<m;i++){
            scanf("%d", &M[i]);
            m_sum+=M[i];
        }
        qsort(M,m,sizeof(int),comp);
        //for(i=0;i<m;i++) printf("M[%d]:%d\n",i,M[i]);
        
        if(n_sum>m_sum){//n_sum-m_sum???n??????m?????????
            for(i=0;i<m;i++){
                for(j=0;j<n;j++){
                    if((N[j]-M[i])*2==n_sum-m_sum){
                        printf("%d %d\n", N[j], M[i]);
                        goto end;
                    }
                }
            }
        }else{//m_sum-n_sum???m??????n?????????
            for(j=0;j<n;j++){
                for(i=0;i<m;i++){
                    if((M[i]-N[j])*2==m_sum-n_sum){
                        printf("%d %d\n", N[j], M[i]);
                        goto end;
                    }
                }
            }
        }
        printf("-1\n");
end:
        ;
    }
    return 0;
}