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

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

#define int long long

void solve() {
	int n, m;
	cin >> n >> m;
	vector<int> x(m);
	for (int i = 0; i < m; ++i) {
		cin >> x[i];
	}
	int ans = -1e18;
	for (int mask = 0; mask < (1 << m); ++mask) {
		int a = 0, b = 0;
		for (int i = 0; i < m; ++i) {
			if (mask >> i & 1) {
				a = x[i] - a;
			} else {
				b = x[i] - b;
			}
		}
		if (a + b > ans) {
			ans = a + b;
		}
	}
	cout << ans << '\n';
}

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

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