#define MAX 100

#include <stdio.h>

int main(void) {
    int n,m,i,j,judge,n_sum,m_sum,n_ans,m_ans;
    int n_card[MAX] = {};
    int m_card[MAX] = {};
    
    while(1){
        n_sum = 0;
        m_sum = 0;
        n_ans = 100;
        m_ans = 100;
        judge = 0;
    
        scanf("%d %d",&n,&m);
        if(n==0 && m==0)
            break;
    
        for(i=0;i<n;i++){
            scanf("%d",&n_card[i]);
            n_sum += n_card[i];
        }
        for(i=0;i<m;i++){
            scanf("%d",&m_card[i]);
            m_sum += m_card[i];
        }
    
        for(i=0;i<n;i++){
            for(j=0;j<m;j++){
                if(n_sum-n_card[i]+m_card[j] == m_sum-m_card[j]+n_card[i]
                        && n_card[i]+m_card[j] < n_ans+m_ans){
                    n_ans = n_card[i];
                    m_ans = m_card[j];
                    judge = 1;
                }
            }
        }
        if(judge==1)
            printf("%d %d\n",n_ans,m_ans);
        else
            printf("-1\n");
        }
    
    return 0;
}