#include<bits/stdc++.h>
using namespace std;
using Int = long long;

template<typename T1,typename T2> void chmin(T1 &a,T2 b){if(a>b) a=b;};
template<typename T1,typename T2> void chmax(T1 &a,T2 b){if(a<b) a=b;};

signed main(){
  Int T;
  cin>>T;

  cout<<fixed<<setprecision(12);
  while(T--){
    double width;
    Int n;
    cin>>width>>n;
    vector<double> w(n);
    for(Int i=0;i<n;i++) cin>>w[i];

    using P = pair<double, double>;
    Int s=1<<n;
    vector<double> sum(s,0);
    for(Int b=0;b<s;b++)
      for(Int i=0;i<n;i++)
	if((b>>i)&1) sum[b]+=w[i];

    function<vector<P>(Int, double)> dfs=[&](Int b,double pos){
      vector<P> res;      
      if(__builtin_popcount(b)==1){
	res.emplace_back(pos,pos);
	return res;
      }
      for(Int nb=b;nb;nb=(nb-1)&b){
	if(nb==b) continue;
	assert(nb&&(nb^b));
	double x=sum[nb],y=sum[nb^b];
	double aa=1.0/(1.0+x/y);
	double bb=1.0-aa;
	auto l=dfs(nb,pos-aa);
	auto r=dfs(nb^b,pos+bb);
	for(auto p:l) 
	  for(auto q:r)
	    res.emplace_back(min({p.first,q.first,p.second,q.second}),
			     max({p.first,q.first,p.second,q.second}));
      }
      return res;
    };
    
    double ans=-1; 
    auto v=dfs(s-1,0);
    for(auto p:v) if(p.second-p.first<width) chmax(ans,p.second-p.first);
    
    if(ans<0) cout<<"-1"<<endl;
    else cout<<ans<<endl;
  }
  return 0;
}


