//#pragma GCC optimize("unroll-loops,Ofast")
//#pragma GCC target("sse,sse2,avx,avx2")

#include <bits/stdc++.h>

#define int long long
using namespace std;
const int inf = 1e18;

//mt19937 rnd(time(0));
void solve() {
    int n, m;
    cin >> n >> m;
    vector<int> a(m);
    for (int i = 0; i < m; ++i) {
        cin >> a[i];
    }
    vector<set<pair<int, int>>> dp(m + 1);
    dp[0].insert({0, 0});
    for (int i = 0; i < m; ++i) {
        for (auto to: dp[i]) {
            dp[i + 1].insert({to.first, a[i] - to.second});
            dp[i + 1].insert({a[i] - to.first, to.second});
        }
    }
    int ans = -inf;
    for (auto to: dp[m]) {
        ans = max(ans, to.first + to.second);
    }
    cout << ans << "\n";
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int _ = 1;
    cin >> _;
    while (_--) {
        solve();
    }
    return 0;
}
