#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>

#define all(a) a.begin(), a.end()

using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

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

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

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