// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

using namespace std;

mt19937 rnd(69); // chrono::steady_clock::now().time_since_epoch().count()
#define all(x) x.begin(), x.end()
#define int long long
#define ull unsigned long long
#define ld long double
#pragma GCC optimize("O3,unroll-loops")
// #pragma GCC target("avx2")

const long long INF = 1e15 + 69;
const int MAXN = 2e5 + 11;

void solve() {
    int n, m, sum;
    cin >> n >> m;
    sum = 0;
    vector<int> x(m);
    multiset<int> cur_last;
    cur_last.clear();
    sum = 0;
    for (int i = 0; i < m; i++) {
        cin >> x[i];
        sum += x[i];
    }
    if (n == 1) {
        sum = 0;
        for (int i = 0; i < m; i++) {
            sum = x[i] - sum;
        }
        cout << sum << endl;
        return;
    }
    int ans = -INF;
    for (int mask = 0; mask < (1 << m); mask++) {
        pair<int, int> cur_ans = {0, 0};
        for (int i = 0; i < m; i++) {
            if ((mask >> i) & 1) {
                cur_ans.second = x[i] - cur_ans.second;
            } else {
                cur_ans.first = x[i] - cur_ans.first;
            }
        }
        ans = max(ans, cur_ans.first + cur_ans.second);
    }
    cout << ans << endl;
}

signed main()
{
    ios_base::sync_with_stdio(false);
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}
