#include <stdio.h>

#define N 100

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  int i, j;

  for ( ; ; )
  {
    int dn[ N ], dm[ N ];
    int rn = 1024, rm = 1024;
    int diff = 0;
    int n, m;

    scanf ( "%d%d", &n, &m );
    if ( !( n | m ) ) break ;

    for ( i = 0; i < n; ++i )
    {
      scanf ( "%d", dn + i );
      diff += dn[ i ];
    }
    for ( i = 0; i < m; ++i )
    {
      scanf ( "%d", dm + i );
      diff -= dm[ i ];
    }

    for ( j = 0; j < n; ++j )
    for ( i = 0; i < m; ++i )
    {
      if ( ( dn[ j ] - dm[ i ] ) * 2 == diff
        && dn[ j ] + dm[ i ] < rn + rm )
      {
        rn = dn[ j ];
        rm = dm[ i ];
      }
    }

    if ( rm == 1024 && rn == 1024 )
    {
      puts ( "-1" );
    }
    else
    {
      printf ( "%d %d\n", rn, rm );
    }
  }

  return ( 0 );
}