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

//#pragma GCC optimize("Ofast, unroll-loops, fast-math, no-stack-protector, inline")
//#pragma GCC target("avx, avx2")

using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using ld = long double;
using ull = unsigned long long;
#define int long long

const ll INF = 1e18 + 228;

random_device rd;
mt19937 rnd(rd() + 228 + 57 - 179);

void solve() {
    ll n, m;
    cin >> n >> m;
    vector<ll> x(m);
    for (int i = 0; i < m; ++i) {
        cin >> x[i];
    }
    ll ans = -INF;
    for (int mask = 0; mask < (1 << m); ++mask) {
        ll z1 = 0, z2 = 0;
        for (int i = 0; i < m; ++i) {
            if (mask & (1 << i)) {
                z2 = x[i] - z2;
            } else {
                z1 = x[i] - z1;
            }
        }
        ans = max(ans, z1 + z2);
    }
    cout << ans;
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int tt = 1;
    cin >> tt;
    while (tt--) solve();
    return 0;
}
