#include <bits/stdc++.h>

using namespace std;
using ll = long long;
#define int ll

void solve() {
    int n, m;
    cin >> n >> m;
    multiset<int> tm;
    for (int i = 0; i < n; i++)
        tm.insert(0);
    vector<int> x(m);
    for (int i = 0; i < m; i++) {
        cin >> x[i];
    }
    int ans = 0;
    int Q = (1 << m);
    for (int q = 0; q < Q; q++) {
        int a = 0, b = 0;
        for (int i = 0; i < m; i++) {
            if ((q >> i) & 1)
                a = x[i] - a;
            else
                b = x[i] - b;
        }
        ans = max(ans, a + b);
    }
    cout << ans << "\n";
}

signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    cin >> t;
    while (t--)
        solve();
}