#include <stdio.h>

int main() {
  int n, m, i, j;
  int s[200];
  int t_sum, h_sum;
  int flag;

  while(1) {
    t_sum = 0;
    h_sum = 0;
    flag = 0;
    scanf("%d %d", &n, &m);
    if(n == 0 && m == 0)
      break;
    else if(n < 0 || n > 100 || m < 0 || m > 100)
      scanf("%d %d", &n, &m);
    for(i = 0; i < n; i++){
      scanf("%d", &s[i]);
      t_sum += s[i];
    }
    for(i = 0; i < m; i++){
      scanf("%d", &s[n+i]);
      h_sum += s[n+i];
    }
    for(i = 0; i < n; i++){
      for(j = 0; j < m; j++){
        if((t_sum - s[i] + s[n+j]) == (h_sum - s[n+j] + s[i])) {
          printf("%d %d\n", s[i], s[n+j]);
          flag = 1;
          break;
        }
      }
      if(flag == 1)
        break;
    }
    if(flag == 0)
      printf("-1\n");
  }
  return 0;
}