#include <cstdio>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

pair<double, double> solve(int a, int b, vector<int>& w, vector<int>& x)
{
    if(a == b)
        return make_pair(0.0, 0.0);

    int c = min_element(x.begin()+a, x.begin()+b) - x.begin();
    int left = accumulate(w.begin()+a, w.begin()+c+1, 0);
    int right = accumulate(w.begin()+c+1, w.begin()+b+1, 0);

    pair<double, double> p = solve(a, c, w, x);
    pair<double, double> q = solve(c+1, b, w, x);
    p.first  -= right / (double)(left + right);
    p.second -= right / (double)(left + right);
    q.first  += left  / (double)(left + right);
    q.second += left  / (double)(left + right);

    return make_pair(min(p.first, q.first), max(p.second, q.second));
}

int main()
{
    int d;
    cin >> d;

    while(--d >= 0){
        double r;
        int s;
        cin >> r >> s;
        vector<int> w(s);
        for(int i=0; i<s; ++i)
            cin >> w[i];

        sort(w.begin(), w.end());
        
        double ret = -1.0;
        do{
            vector<int> x(s-1);
            for(int i=0; i<s-1; ++i)
                x[i] = i;

            do{
                pair<double, double> p = solve(0, s-1, w, x);
                double len = p.second - p.first;
                if(len < r)
                    ret = max(ret, len);
            }while(next_permutation(x.begin(), x.end()));
        }while(next_permutation(w.begin(), w.end()));

        if(ret < -0.5)
            cout << -1 << endl;
        else
            printf("%.10f\n", ret);
    }

    return 0;
}