#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>

#define all(a) a.begin(), a.end()

using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

constexpr ll inf = 1e18;

void solve() {
    int n, m;
    cin >> n >> m;
    vector<ll> x(m);
    for (ll &e : x) cin >> e;
    set<pll> able;
    able.emplace(0, 0);
    for (ll const &e : x) {
        auto able_ = able;
        for (pll const &p : able_) {
            able.insert(e - p.first, p.second);
            able.insert(p.first, e - p.second);
        }
    }
    ll ans = -inf;
    for (pll const &p : able) ans = max(ans, p.first + p.second);
    cout << ans << '\n';
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int t;
    cin >> t;
    while (t--)
    solve();
}