#include<bits/stdc++.h>
#define int long long
using namespace std;

const int INF = 1e18;
const int K = 500;

void solve() {
    int n, m, s = 0, ans = -INF;
    cin >> n >> m;
    vector<int> x(m);
    for (int i = 0; i < m; i++) cin >> x[i];
    set<array<int, 2>> dp, dp2;
    dp.insert({0, 0});
    for (int i = 0; i < m; i++) {
        for (auto [v1, v2]: dp) {
            dp2.insert({x[i] - v1, v2});
            dp2.insert({v1, x[i] - v2});
        }
        dp = dp2;
        dp2.clear();
    }
    for (auto [v1, v2]: dp) {
        ans = max(ans, v1 + v2);
    }
    cout << ans;
}

int32_t main() {
    cin.tie(0);
    ios::sync_with_stdio(0);

    int tt;
    cin >> tt;
    while (tt--) {
        solve();
        cout << '\n';
    }
}
