#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

#define int long long
using ll = long long;

typedef tree<int, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const int inf = 1e9 + 7;
const ll inf_ = 1e18 + 7;
const int mod = 998244353;

struct Fast {
    void solve() {
        int n, m;
        cin >> n >> m;
        vector<int> b(m);
        for (auto &i: b) cin >> i;
        reverse(b.begin(), b.end());
        int ans = -inf_;
        vector<vector<int>> dp(m + 1, vector<int>(1 << n, -inf_));
        dp[0][0] = 0;
        for (int i = 1; i <= m; i++) {
            for (int mask = 0; mask < (1 << n); mask++) {
                for (int l = 0; l < n; l++) {
                    int msk = mask, c = -b[i - 1];
                    msk ^= (1 << l);
                    if ((mask >> l) & 1) c = -c;
                    dp[i][mask] = max(dp[i][mask], dp[i - 1][msk] + c);
                }
                if (i == m) ans = max(ans, dp[i][mask]);
            }
        }
        cout << ans;
    }
};

signed main() {
    int __ = 1;
    cin >> __;
    while (__--) {
        Fast().solve();
        cout << '\n';
    }
    return 0;
}
