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

using namespace __gnu_pbds;
using namespace std;

template<class T>
using order_set = tree<T, nullptr_t, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

using ll = long long;
using ld = long double;
using mll = map<ll, ll>;
using pll = pair<ll, ll>;
using vll = vector<ll>;

const ll inf = 1e16;
const ll mod = 1e9 + 7;
const ld eps = 1e-9;

const ll nmax = 5e5 + 1;



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

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

    ll test;
    cin >> test;
    while (test--) {
        ll n, m;
        cin >> n >> m;
        vector<ll> x(m);
        for (ll &i: x)
            cin >> i;

        ll res = -inf;
        for (ll mask = 0; mask < (1 << m); mask++) {
            ll a0 = 0, a1 = 0;
            for (ll i = 0; i < m; i++) {
                if (mask >> i & 1)
                    a0 = x[i] - a0;
                else
                    a1 = x[i] - a1;
            }
            res = max(res, a0 + a1);
        }
        cout << res << '\n';
    }
}
