#include <bits/stdc++.h>

using namespace std;
#define int int64_t
const int INF = 1e18;
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 i = 0; i < (1 << m); i++) {
        int g = 0, h = 0;
        for (int j = 0; j < m; j++) {
            if ((i & (1 << j)) == (1 << j)) {
                g = x[j] - g;
            }
            if ((i & (1 << j)) == 0) {
                h = x[j] - h;
            }
        }
        ans = max(ans, h + g);
    }
    cout << ans << '\n';
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
}


