#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#pragma GCC optimize("Ofast")

using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using ld = long double;

ll inf = (ll)1e18;

template<class T>
ll len(T& a) {
    return (ll)a.size();
}

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

    vector<ll> a(m);
    for (ll i = 0; i < m; ++i) {
        cin >> a[i];
    }

    ll res = 0;
    for (ll bit = 0; bit < (1ll << m); ++bit) {
        ll a1 = 0, a2 = 0;
        for (ll i = 0; i < n; ++i) {
            if ((bit >> i) & 1ll) {
                a1 = a[i] - a1;
            } else {
                a2 = a[i] - a2;
            }
        }
        res = max(res, a1 + a2);
    }
    cout << res << "\n";
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    ll tt;
    cin >> tt;
    while (tt--) {
        solve();
    }

    return 0;
}
