#include <bits/extc++.h>

using namespace std;
using namespace __gnu_pbds;

#define itn int
#define int long long
#define all(a) begin(a), end(a)
#define rall(a) rbegin(a), rend(a)
#define pii pair<int, int>
#define ff first
#define ss second
#define sz(a) (int)(a).size()
#define ll long long
#define ld long double

mt19937 rnd(time(0));

int ans = -1e18 - 7;
vector <int> dv, a, b;

void gen(int i, int m, int cur){
    if (i == m){
        a[0] = 0, a[1] = 0;
        for (int j = 0; j < m; ++j){
            a[dv[j]] = b[j] - a[dv[j]];
        }
        ans = max(a[0] + a[1], ans);
        return;
    }

    if (cur == 0){
        dv.push_back(0);
        gen(i + 1, m, cur);
        dv.pop_back();
    }
    else{
        for (int j = 0; j < 2; ++j){
            dv.push_back(j);
            gen(i + 1, m, cur - j);
            dv.pop_back();
        }
    }
}


void solve(){
    int n, m;
    cin >> n >> m;
    a.resize(2);
    b.resize(m);
    for (auto &x: b){
        cin >> x;
    }

    gen(0, m, m);

    cout << ans << '\n';
}

signed main(){
    cin.tie(nullptr) ->sync_with_stdio(false);

#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    int t = 1;
    cin >> t;
    while (t--){
        solve();
    }
}