#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;
vector<int> bb, w;
int ans = -INF;
void get(int v, int m, int k) {
    if (v == m) {
        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(), w1.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);

        return;
    }
    if (k <= m / 2) {
        w[v] = 1;
        get(v + 1, m, k + 1);
        w[v] = 0;
        get(v + 1, m, k);
    }
    else {
        w[v] = 0;
        get(v + 1, m, k);
    }
}

void resh() {
    int n, m;
    cin >> n >> m;
    bb.resize(m);
    for (auto& i : bb) {
        cin >> i;
    }
    w.resize(m, 0);
    ans = -INF;
    get(0, m, 0);
































    cout << ans << '\n';
}
signed main() {
    int t;
    cin >> t;
    for (int i = 0; i < t; i++) {
        resh();
    }
}