#ifdef _MSC_VER
#include <__msvc_all_public_headers.hpp>
#else
#include <bits/stdc++.h>
#endif

using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll infll = 1e18;

template<typename T>
istream& operator>>(istream& is, vector<T>& a) {
	for (auto& i : a) {
		is >> i;
	}
	return is;
}

mt19937 rng(228);

int32_t main() {
#ifdef LOCAL
	assert(freopen("C:\\Users\\User\\input.txt", "r", stdin));
#else
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
#endif
	int t;
	cin >> t;
	while (t--) {
		int n, m;
		cin >> n >> m;
		vector<ll> x(m);
		cin >> x;
		ll ans = -infll;
		for (int mask = 0; mask < (1 << m); ++mask) {
			vector<ll> a(2);
			for (int i = 0; i < m; ++i) {
				int bit = ((mask >> i) & 1);
				a[bit] = x[i] - a[bit];
			}
			ans = max(ans, a[0] + a[1]);
		}
		cout << ans << "\n";
	}
	return 0;
}