#include <stdio.h>


void swap(int x,int y){
    int tmp;
    
    tmp=x;
    x=y;
    y=tmp;

}

int main(int argc, const char * argv[]) {
    
    int n,m,taro[100],hana[100],card,i=0,j = 0,tsum = 0,hsum = 0,flag = 0;
    
    while (1) {
        scanf("%d %d",&n,&m);
        
        if (n==0&&m==0) {
            break;
        }
        //card??\??????
        for (i = 0; i < n; i++) {
            scanf("%d",&card);
            taro[i] = card;
        }
        //card??\??????
        for (i = 0; i < m; i++) {
            scanf("%d",&card);
            hana[i] = card;
        }
        
        //?????????sort(??????)
        
        for (i = 0; i < n-1; i++) {
            for (j = n-1; j > i; j--) {
                //taro
                if (taro[j] < taro[j-1]) {
                    swap(taro[j],taro[j-1]);
                }
                //hana
                if (hana[j] < hana[j-1]) {
                    swap(hana[j],hana[j-1]);
                }
                
            }
        }
        
        for (i=0; i<n; i++) {
            tsum += taro[i];
        }
        
        for (i=0; i<m; i++) {
            hsum += hana[i];
        }
        
        //????????????????????§??????????????????????????????????°?
        for (i = 0; i < n; i++) {
            for (j = 0; j < m; j++) {
                if (tsum-(2*taro[i]) == hsum-(2*hana[j])) {
                    printf("%d %d\n",taro[i],hana[j]);
                    flag = 1;
                    break;
                }
            }
            if (flag==1) {
                //printf("flag1\n");
                break;
            }
        }
        
        if (flag == 0) {
            printf("-1\n");
        }
        
        flag = 0;
        tsum = 0;
        hsum = 0;
    }
    return 0;
}