import std.stdio;
import std.algorithm;
import std.conv;
import std.string;
import std.range;
import std.math;

void main() {
    while (true) {
        int n, m;
        readf("%d %d\n", &n, &m);
        if (!(n||m)) break;

        int[] taro = new int[n];
        int[] hanako = new int[m];

        foreach (i; 0..n) {
            taro[i] = readln.chomp.to!int;
        }

        foreach (i; 0..m) {
            hanako[i] = readln.chomp.to!int;
        }

        if ((taro.reduce!("a + b") - hanako.reduce!("a + b")) % 2 != 0) {
            (-1).writeln;
            continue;
        }

        int diff = (taro.reduce!("a + b") - hanako.reduce!("a + b")) / 2;

        int[][] answers;

        foreach (t; taro) {
            foreach (h; hanako) {
                if (t - h == diff) {
                    answers ~= [t, h];
                }
            }
        }

        if (answers.empty) {
            (-1).writeln;
            continue;
        }

        int[] ans = answers[0];
        foreach (a; answers) {
            if (ans[0] + ans[1] > a[0] + a[1]) {
                ans = a;
            }
        }

        writefln("%d %d", ans[0], ans[1]);
    }
}