#!/usr/bin/ruby
#
# 1029.rb: Traffic Analysis
#

### constant

MAX_INT = 1 << 30

### main

loop do
  n, m = gets.strip.split(' ').map(&:to_i)
  break if n == 0 && m == 0

  tls = (n > 0 ? gets.strip.split(' ').map(&:to_i) : []) + [MAX_INT]
  trs = (m > 0 ? gets.strip.split(' ').map(&:to_i) : []) + [MAX_INT]

  max_d = 0

  t0 = t1 = 0
  li = ri = 0

  loop do
    if tls[li] <= trs[ri]
      t1 = tls[li]
      li += 1
    else
      t1 = trs[ri]
      ri += 1
    end
    break if t1 >= MAX_INT

    d = t1 - t0
    max_d = d if max_d < d

    t0 = t1
  end

  puts max_d
end