//#pragma GCC optimize("Ofast")
#include <vector>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <bits/stdc++.h>
#define int long long
#define ld long double
#define speed ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
//#pragma GCC target("avx2")
const int INF = 1e12, maxn = 3e5 + 100;
void resh() {
    int n, m;
    cin >> n >> m;
    vector<int> bb(m);
    for (auto& i : bb) {
        cin >> i;
    }

    int ans = -INF;
    for (int qwe = 0; qwe < (1ll << m); qwe++) {
        vector<int> w(m, 0);
        int s = qwe, ind = 0;
        while (s > 0) {
            w[ind++] = s % 2;
            s /= 2;
        }

        vector<int> w1, w2;
        for (int i = 0; i < m; i++) {
            if (w[i]) {
                w1.push_back(bb[i]);
            }
            else {
                w2.push_back(bb[i]);
            }
        }
        reverse(w1.begin(), w2.end());
        reverse(w2.begin(), w2.end());
        int res = 0;
        for (int i = 0; i < (int)w1.size(); i++) {
            if (i % 2 == 0) {
                res += w1[i];
            }
            else {
                res -= w1[i];
            }
        }
        for (int i = 0; i < (int)w2.size(); i++) {
            if (i % 2 == 0) {
                res += w2[i];
            }
            else {
                res -= w2[i];
            }
        }
        ans = max(ans, res);
    }
    cout << ans << '\n';
}
signed main() {
    int t;
    cin >> t;
    for (int i = 0; i < t; i++) {
        resh();
    }
}