#include <bits/stdc++.h>
#define int long long

using namespace std;

vector<int> cur;
long long sum = -2e18;  

void rec(int n, vector<long long>& a) {
    if (n == 0) {
        int ind = 0, cnt1 = 0, cnt2 = 0;
        long long answ = 0;
        int f1 = 0, f2 = 0;
        for (auto i : cur) {
            if (i) f1++;
            else f2++;
        }
        if (f1 % 2 == 0) f1 = 1;
        else f1 = 0;
        if (f2 % 2 == 0) f2 = 1;
        else f2 = 0;
        for (auto i : cur) {
            if (!i) {
                if (cnt1 % 2 == f2) answ += a[ind];
                else answ -= a[ind];
                cnt1++;
            } else {
                if (cnt2 % 2 == f1) answ += a[ind];
                else answ -= a[ind];
                cnt2++;
            }
            ind++;
        }
        sum = max(sum, answ);
        return;
    }
    cur.push_back(1);
    rec(n - 1, a);
    cur.pop_back();
    cur.push_back(0);
    rec(n - 1, a);
    cur.pop_back();
}

void solve() {
    long long n, m; cin >> n >> m;
    vector<long long> a(m);
    for (int i = 0; i < m; i++) {
        cin >> a[i];
    }
    rec(m, a);
    cout << sum << '\n';
}

signed main() {
    //ios::sync_with_stdio(false);
    //cin.tie(nullptr);
    int t; cin>> t;
    while (t--) solve();
}
