#include <iostream>
#include <vector>
#include <algorithm>

#define int long long

using namespace std;

int32_t main() {
	int t;
	cin >> t;
	for (; t > 0; --t) {
		int n, m;
		cin >> n >> m;
		if (n != 2) {
			while (1);
		}
		vector<int>v(m);
		for (int i = 0; i < m; ++i)cin >> v[i];
		int x = (1ll << m);
		int ans = -1e15;
		for (int jkl = 0; jkl < x; ++jkl) {
			pair<int, int>opa = { 0,0 };
			for (int i = 0; i < m; ++i) {
				if ((jkl >> i) % 2 == 1) {
					opa.second = v[i] - opa.second;
				}
				else {
					opa.first = v[i] - opa.first;
				}
			}
			ans = max(ans, opa.first + opa.second);
		}
		cout << ans << '\n';
	}
	return 0;
}