#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<set>
#include<bitset>
#include<algorithm>

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int tt;
	cin >> tt;
	while (tt--) {
		int64_t n, m;
		cin >> n >> m;
		vector<int64_t> a(m);
		for (int64_t i = 0; i < m; ++i) {
			cin >> a[i];
		}
		int64_t res = -1e9;
		for (int64_t i = 0; i < 10000000; ++i) {
			vector<int64_t> cur(n);
			for (int64_t j = 0; j < m; ++j) {
				if (i & (1 << j)) {
					cur[0] = a[j] - cur[0];
				}
				else {
					cur[1] = a[j] - cur[1];
				}
			}
			res = max(res, cur[0] + cur[1]);
		}
		cout << res << '\n';
	}
	return 0;
}