#include <bits/stdc++.h>

using ll = long long;

using namespace std;

vector<ll> A;
ll perm(ll m) {
    ll ans = -1e18;
    for (ll i = 0; i < (1 << m); i++) {
        ll k = i, j = 0, d = 0;
        vector<ll> B(m);
        while (k > 0) {
            if (k % 2) {
                B[j] = 1;
                d++;
            }
            //cout << k % 2;
            k /= 2;
            j++;
        }
        //cout << '\n';
        ll sum = 0;
        ll p;
        if ((d) % 2 == 1) {
            p = 1;
        } else {
            p = -1;
        }
        for (ll j = 0; j < m; j++) {
            if (B[j] == 1) {
                sum += A[j] * p;
                if (p == 1) {
                    p = -1;
                } else {
                    p = 1;
                }
            }
        }
        if ((m - d) % 2 == 1) {
            p = 1;
        } else {
            p = -1;
        }
        for (ll j = 0; j < m; j++) {
            if (B[j] == 0) {
                sum += A[j] * p;
                if (p == 1) {
                    p = -1;
                } else {
                    p = 1;
                }
            }
        }
        ans = max(ans, sum);
    }
    return ans;
}

void solve() {
    ll n, m;
    cin >> n >> m;
    A.assign(m, 0);
    for (ll i = 0; i < m; i++) {
        cin >> A[i];
    }
    cout << perm(m) << '\n';
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll t = 1;
    cin >> t;
    for (ll i = 0; i < t; i++) {
        solve();
    }
    return 0;
}
