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

using namespace std;

long long rec(long long a, long long b, long long ind, vector<long long>& a1) {
	if (ind == (long long)a1.size()) {
		return a + b;
	}
	long long x1 = rec(a1[ind] - a, b, ind + 1, a1);
	long long x2 = rec(a, a1[ind] - b, ind + 1, a1);
	return max(x1, x2);
}

int main() {
	int t;
	cin >> t;
	while (t--) {
		int n, m;
		cin >> n >> m;
		vector<long long> a(m);
		for (int i = 0; i < m; i++) {
			cin >> a[i];
		}
		if (n == 2) {
			cout << rec(0, 0, 0, a) << '\n';
		}
	}
	

}