#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")

using namespace std;
using ll = long long;
using ld = long double;

#define int long long

int n, m;
vector<int> x;

void solve() {
	cin >> n >> m;
	x.resize(m);
	for (int i = 0; i < m; ++i) {
		cin >> x[i];
	}
	unordered_set<pair<int, int>> dp;
	dp.insert({0, 0});
	for (int i = 0; i < m; ++i) {
		set<pair<int, int>> new_dp;
		for (auto it : dp) {
			new_dp.insert({x[i] - it.first, it.second});
			new_dp.insert({it.first, x[i] - it.second});
		}
		dp = new_dp;
	}
	int ans = -1e18;
	for (auto it : dp) ans = std::max(ans, it.first + it.second);
	cout << ans << '\n';
}

signed main() {
	ios_base::sync_with_stdio(0); cin.tie(0);

	int tests;
	cin >> tests;
	while (tests--) {
		solve();
	}
}
