#include <iostream>
#include <random>
#include <cmath>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <algorithm>
#include <vector>
#include <string>

#define all(x) x.begin(), x.end()
#define ll long long
#define vll vector<ll>

using namespace std;

void solve() {
    ll n, m;
    cin >> n >> m;

    vll a(m, 0);
    for (ll i = 0; i < m; i++) {
        cin >> a[i];
    }
    vll b(n, 0);
    ll ans = 0;

    for (ll mask = 0; mask < (1LL << m); mask++) {
        for (ll i = 0; i < m; i++) {
            if (mask & (1LL << i)) {
                b[1] = a[i] - b[1];
            } else {
                b[0] = a[i] - b[0];
            }
        }
        ans = max(ans, b[0] + b[1]);
        b[0] = 0;
        b[1] = 0;
    }

    cout << ans << endl;
}
ll t;

signed main() {
    cin >> t;
    while (t--) {
        solve();
    }
    
}