#include <bits/stdc++.h>

using namespace std;
using ll = long long;
//#define int ll
const int inf = 1e9;

const int mxv = 1.2e3;
const int hehehaha = 3'200'000;

mt19937 rnd(1337228);

int rand(int l, int r) {
    return l + rnd() % (r - l + 1);
}

void solve() {
    int n, m;
    cin >> n >> m;
    vector<int> x(m);
    for (int i = 0; i < m; i++) {
        cin >> x[i];
    }
    int ans = -inf;
    for (int _ = 0; _ < hehehaha; _++) {
        int a = 0, b = 0;
        for (int i = 0; i < m; i++) {
            int op = rand(1, 2);
            if (op == 1)
                a = x[i] - a;
            else
                b = x[i] - b;
        }
        ans = max(ans, a + b);
    }
    cout << ans << "\n";
}

signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    cin >> t;
    while (t--)
        solve();
}