def minNetDiff(a, b):
  """
  Returns an offset s that minimizes (zeros) the net difference between the 
  equal length lists a and b. Net difference is the sum of all pairwise 
  differences: a_elem - (b_elem + s).

  Let n = number of elements in a (and in b)
  E = -(n * s) + sum(a) - sum(b)
  
  Args:
    a: A list of values
    b: A list of values
  Return:
    A floating point offset
  """
  assert len(a) == len(b)
  assert len(a) != 0

  # Find the root
  s = (sum(a) - sum(b)) / float(len(a))
  return s