#pragma GCC optimize("Ofast")
// #include <alloca.h>

#include <bits/stdc++.h>
#pragma GCC target("avx2")
using namespace std;
#ifdef _LOCAL
#define debug(x) cout << __LINE__ << ' ' << __PRETTY_FUNCTION__ << ": " << (x) << endl
#else
#define debug(...) 238;
#endif
mt19937 rng(238);
mt19937_64 rng64(238);
using ll = long long;
template <typename T, int U>
using ar = array<T, U>;
template <typename T, typename U>
bool chmin(T& x, const U&& y) {
    if (x > y) {
        x = y;
        return true;
    }
    return false;
}
template <typename T, typename U>
bool chmax(T& x, const U&& y) {
    if (x < y) {
        x = y;
        return true;
    }
    return false;
}

#include <ext/pb_ds/assoc_container.hpp>
template <typename T>
using ordered_set = __gnu_pbds::tree<T, __gnu_pbds::null_type,
                                     less<T>,
                                     __gnu_pbds::rb_tree_tag,
                                     __gnu_pbds::tree_order_statistics_node_update>; 
constexpr int Inf = 0x3f3f3f3f;
constexpr ll inf = 1144000000000000000;

void solve() {
    int n, m;
    cin >> n >> m;
    vector<ll> x(m);
    for (ll& v : x) {
        cin >> v;
    }
    
    ll ans = 0;
    for (int i = 0; i < (1 << m); ++i) {
        ll aa = 0, bb = 0;
        for (int j = 0; j < m; ++j) {
            if ((i >> j) & 1) {
                aa = x[j] - aa;
            } else {
                bb = x[j] - bb;
            }
        }
        ans = max(ans, aa + bb);
    }
    cout << ans;
    

}

signed main() {
#ifdef _LOCAL
    freopen("test.in", "r", stdin);
    freopen("test.out", "w", stdout);
    freopen("test.out", "w", stderr);
#endif
    cin.tie(0)->sync_with_stdio(0);

    int Tc = 1;
    cin >> Tc;
    while (Tc--) {
        solve();
        cout << '\n';
    }

    return 0;
}