#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using ld = long double;
template <typename T>
ll sz(T& a) {
    return (ll)a.size();
}





int main() {
//    cout.setf(ios::fixed); cout.precision(15);
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#ifdef manix888
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif


    int tt;
    cin >> tt;
    while (tt--) {
        int n, m;
        cin >> n >> m;
        vector<ll> nums(m);
        for (int i=0; i<m; i++) cin >> nums[i];

        ll ans = -1e18;
        for (int mask=0; mask<(1<<n); mask++) {
            ll v1=0, v2=0;
            for (int i=0; i<n; i++) {
                if ((mask>>i)&1) v1 = nums[i] - v1;
                else v2 = nums[i] - v2;
            }
            ans = max(ans, v1+v2);
        }
        cout << ans << '\n';
    }


    return 0;
}
