#include <stdio.h>
main(){
  int i,n,m,l,r,tl[10000],tr[10000],total[20001],ans;
  while(1){
    scanf("%d%d",&n,&m);
    if(n == 0 && m == 0) break;
    
    for(i=0;i<n;i++){
      scanf("%d",&tl[i]);
    }
    for(i=0;i<m;i++){
      scanf("%d",&tr[i]);
    }
    
    l = 0;
    r = 0;
    i = 1;
    total[0] = 0;
    while(r < m || l < n){
      if(r >= m || (l < n && tl[l] < tr[r])) total[i++] = tl[l++];
      else total[i++] = tr[r++];
    }
    
    ans = 0;
    for(i=1;i<=l+r;i++){
      if(total[i]-total[i-1] > ans) ans = total[i]-total[i-1];
    }

    printf("%d\n",ans);
  }
  return 0;
}