#include <iostream>
#include <set>
#include <vector>
#include <random>
#include <iomanip>
//#include <fstream>
#include <algorithm>
#include <map>
#include <unordered_set>
#include <unordered_map>

using namespace std;
#define int long long
void dfs0(vector<vector<int>>& g, vector<int>& h, int u, int p) {
    for (auto v : g[u]) {
        if (v == p) continue;
        h[v] = h[u] + 1;
        dfs0(g, h, v, u);
    }
}
int dfs1(vector<vector<int>>& g, vector<int>& cost, int u, int p, int cst) {
    if (cost[u] <= cst) return 0;
    int ans = 1;
    for (auto v : g[u]) {
        if (v == p) continue;
        if (cost[v] <= cst) continue;
        ans += dfs1(g, cost, v, u, cst);
    }
    return ans;
}
signed main()
{
    cin.tie(nullptr)->sync_with_stdio(false);
    int q;
    cin >> q;
    while (q--) {
        int n, m;
        cin >> n >> m;
        vector<int> x(m);
        for (int i = 0; i < m; i++) {
            cin >> x[i];
        }
        int ans = 0;
        for (int i = 0; i < (1ll << m); i++) {
            int sm1 = 0, sm2 = 0;
            for (int j = 0; j < m; j++) {
                if ((1ll << j) & i) {
                    sm1 = x[j] - sm1;
                }
                else {
                    sm2 = x[j] - sm2;
                }
            }
            ans = max(ans, sm1 + sm2);
        }
        cout << ans << '\n';
    }
}