#include "bits/stdc++.h"

using namespace std;

#define int long long

void solve() {
    int n, m;
    cin >> n >> m;

    vector<int> s(m);

    for (int i = 0; i < m; i++) {
        cin >> s[i];
    }

    vector<int> ans(n), d;
    int res = -1e18;

    function<void(int)> rec = [&](int cnt) {
        if (cnt == m) {
            ans.clear();
            ans.resize(n);

            for (int i = 0; i < m; i++) {
                ans[d[i]] = s[i] - ans[d[i]];
            }

            int sum = 0;

            for (int i = 0; i < n; i++) {
                sum += ans[i];
            }

            res = max(res, sum);
            return;
        }

        for (int i = 0; i < n; i++) {
            d.emplace_back(i);
            rec(cnt + 1);
            d.pop_back();
        }
    };

    rec(0);

    cout << res << '\n';
}
signed main() {
#ifdef local
    freopen("input.txt", "r", stdin);
    freopen("answer.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int akbalin = 1;
    cin >> akbalin;

    for (int i = 1; i <= akbalin; i++) {
        solve();
    }
}