#define _GLIBCXX_DEBUG
#define _GLIBCXX_DEBUG_PEDANTIC

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define OPTIMIZETHISSHIT ios::sync_with_stdio(false); cin.tie(nullptr);
#define int long long

using namespace std;
using namespace __gnu_pbds;

template<typename T>
using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

mt19937_64 rng(0);

int rand(int l, int r) {
    return uniform_int_distribution<int>(l, r)(rng);
}

void solve() {
    int n;
    cin >> n;
    int m;
    cin >> m;
    vector<int> a(m);
    for (int i = 0; i < m; i++) cin >> a[i];
    int ans = -INT_MAX;
    for (int mask = 0; mask < (1 << m); mask++) {
        vector<int> b(n);
        for (int j = 0; j < m; j++) {
            if (mask & (1 << j)) {
                b[1] = a[j] - b[1];
            } else {
                b[0] = a[j] - b[0];
            }
        }
        ans = max(ans, b[0] + b[1]);
    }
    cout << ans << endl;
}

signed main() {
    OPTIMIZETHISSHIT

    int t;
    cin >> t;
    while (t--) solve();
}