import std.stdio;
import std.string, std.conv;
import std.algorithm, std.array;

void main() {
  for(;;) {
    int stdin[] = readln().split().map!(to!int)().array();
    const N = stdin[0];
    const M = stdin[1];
    if(N == 0 && M == 0) break;

    int taro[] = new int[N];
    int hanako[] = new int[M];
    int ts = 0, hs = 0;
    foreach(i; 0 .. N) {
      taro[i] = readln().chomp().to!int();
      ts += taro[i];
    }

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

    int ta = -1, ha = -1;
    int ss = cast(int)1e9;

    foreach(t; taro) {
      foreach(h; hanako) {
        if(ts - t + h == hs - h + t && t + h < ss) {
          ta = t;
          ha = h;
          ss = t + h;
        }
      }
    }

    if(ta == -1 && ha == -1)
      writeln(-1);
    else
      writefln("%d %d", ta, ha);
  }
}