### subroutines

def max_w(mbls)
  len = mbls.length
  
  if len == 1
    mbl = mbls.first
    return mbl[1] + mbl[2]
  end

  mw = 0.0

  for i in (0...(len - 1))
    wi0, l0, r0 = mbls[i]
    wi1, l1, r1 = mbls[i + 1]

    nwi = wi0 + wi1
    li = wi1 / nwi
    ri = wi0 / nwi
    nl0 = l0 + li
    nr0 = r0 - li
    nl1 = l1 - ri
    nr1 = r1 + ri
    nmbl = [nwi, (nl0 > nl1) ? nl0 : nl1, (nr0 > nr1) ? nr0 : nr1]

    nmbls = mbls[0...i] + [nmbl] + mbls[(i + 2)...len]
    w = max_w(nmbls)
    mw = w if mw < w && w < $rw
  end

  mw
end

### main

n = gets.to_i

n.times do
  $rw = gets.to_f
  sn = gets.to_i

  wis = sn.times.map{gets.to_f}
  #p [rw, wis]

  mbls = wis.map{|wi| [wi, 0.0, 0.0]}
  #p mbls
  
  mw = 0.0

  mbls.permutation.each do |mbls0|
    w = max_w(mbls0)
    mw = w if mw < w && w < $rw
  end

  puts (mw == 0.0) ? -1 : mw
end