#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#include <map>
using namespace std;

#define ll long long
#define ull unsigned long long
#define db double
#define str string
#define vc vector
#define its(a) (a).begin(), (a).end()
#define itsr(a) (a).rbegin(), (a).rend()
#define tstr(a) to_string((a))
#define INF ((ll)1e18)

void solve() {
    ll n, m; cin >> n >> m;
    vc<ll> x(m); 
    for (auto& i : x) cin >> i;
    ll a = 0, b = 0;
    ll ans = -INF;

    for (int msk = 0;msk < (1 << m);++msk) {
        for (int i = 0;i < m;++i) {
            if ((msk >> i) & 1) b = x[i] - b;
            else a = x[i] - a;
        }
        ans = max(ans, a + b);
    }
    cout << ans << '\n';
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll _t = 1;
    cin >> _t;
    while (_t--)
        solve();
}
