import std.stdio, std.string, std.conv, std.algorithm, std.numeric;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;

void main() {
    while (true) {
        int n, m;
        scan(n, m);

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

        auto t = iota(n).map!(i => readln.chomp.to!int).array;
        auto h = iota(m).map!(i => readln.chomp.to!int).array;

        solve(n, m, t, h);
    }
}

void solve(int n, int m, int[] t, int[] h) {
    int ts = t.sum, hs = h.sum;
    int ps = 10000;
    int st = -1, sh = -1;

    foreach (i ; 0 .. n) {
        foreach (j ; 0 .. m) {
            auto a = ts - t[i] + h[j];
            auto b = hs - h[j] + t[i];

            if (a == b && t[i] + h[j] < ps) {
                st = i, sh = j;
                ps = t[i] + h[j];
            }
        }
    }

    if (st != -1) {
        writeln(t[st], " ", h[sh]);
    }
    else {
        writeln(-1);
    }
}



void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}