#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll tt = 1;
    cin >> tt;
    while (tt--) {
        solve();
    }
}
