#pragma GCC optimize("O3", "unroll-loops")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#pragma GCC target("avx2")

using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using ost = tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>;
template<long long N, class T = long long>
using pii = array<T, N>;

void run() {
    ll n, m;
    cin >> n >> m;
    ll arr[2]{};
    ll vls[50]{};
    for (ll i = 0; i < m; ++i) cin >> vls[i];
    ll out = 0;
    for (ll i = 0; i < (1 << m); ++i){
        for (ll j = 0; j < m; ++j)
            arr[bool(i & (1 << j))] = vls[j] - arr[bool(i & (1 << j))];
        out = max(out, arr[0] + arr[1]);
    }
    cout << out << '\n';
}

int main() {
    ll t;
    cin >> t;
    while (t--) run();

    return 0;
}
