#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <map>
#include <random>
#include <chrono>

#define int long long

using namespace std;
/*
struct node{
    int x;
    int lazy;
};

vector<node> t;

mt19937 G(chrono::high_resolution_clock::now().time_since_epoch().count());

void push(int v, int l, int r) {
    if (t[v].lazy == 0) {
        return;
    }
    if (l != r-1) {
        t[2*v + 1].lazy += t[v].lazy;
        t[2*v + 2].lazy += t[v].lazy;
    }
    t[v].x += (r-l)*t[v].lazy;
    t[v].lazy = 0;
}

void upd(int v, int l, int r, int ql, int qr, int x) {
    push(v, l, r);
    if (qr <= l && r <= ql) {
        return;
    }
    if (ql >= l && qr <= r) {
        t[v].lazy += x;
        return;
    }
    int m = (l+r)/2;
    upd(2*v+1, l, m, ql, qr, x);
    upd(2*v+2, m, r, ql, qr, x);
    t[v].x = t[2*v+1].x + t[2*v+2].x;
}

int get(int v, int l, int r, int ql, int qr) {
    push(v, l, r);
    if (qr <= l || ql >= r) {
        return 0;
    }
    if (ql >=l && qr <= r) {
        //t[v].x += (r-l)*t[v].lazy;
        return t[v].x;
    }
    int m = (l+r)/2;
    return get(2*v + 1, l, m, ql, qr) + get(2*v + 2, m, r, ql, qr);
}
*/



signed main() {
    //cin.tie(nullptr);
    //ios::sync_with_stdio(false);
    vector<int> pow(30);
    pow[0] = 1;
    for (int i = 1; i < 30; i++) {
        pow[i] = 2*pow[i-1];
    }
    cout << pow[7];
    int t;
    cin >> t;
    while (t--) {
        //cout << "a";
        int n, m;
        cin >> n >> m;
        vector<int> x(m);
        for (int i = 0; i < m; i++) {
            cin >> x[i];
        }
        int ans = -100000000000;
        for (int mask = 0; mask < pow[m]; mask++) {
            vector<int> a(n, 0);
            for (int i = 0; i < m; i++) {
                if ((mask >> i) & 1) {
                    a[1] = x[i] - a[1];
                } else {
                    a[0] = x[i] - a[0];
                }
            }
            int res = 0;
            for (auto e : a) {
                res += e;
            }
            ans = max(ans, res);
        }
        cout << ans << '\n';
    }
    return 0;
}
