#include <iostream>
#include <vector>
#define int long long

using namespace std;

int maxx(int a, int b)
{
	if (a > b) return a;
	return b;
}

int minn(int a, int b)
{
	if (a < b) return a;
	return b;
}

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t;
	cin >> t;
	while (t--)
	{
		int n, m;
		cin >> n >> m;
		vector<int> x(m);
		for (int i = 0; i < m; ++i) cin >> x[i];
		vector<int> a(2);
		int mixx = 1e15;
		for (int mask = 0; mask < (1 << m); ++mask)
		{
			for (int i = 0; i < m; ++i)
			{
				a[mask & (1 << i)] = x[i] - a[mask & (1 << i)];
			}
			if ((mixx == 1e15) || (a[0] + a[1] > mixx)) mixx = a[0] + a[1];
		}
		cout << mixx << '\n';
	}
}