#include <iostream>
using namespace std;
#define int long long
int const N=100;
int a[N],b[N];
int ans=-1e15;
	int n,m;
void rec(int i)
{
	if (i==m)
	{
		int z=0;
		for (int j=0;j<n;j++)
			z+=a[j];
		ans=max(ans,z);
		return;
	}
	for (int j=0;j<n;j++)
	{
		int pr=a[j];
		a[j]=b[i]-a[j];
		rec(i+1);
		a[j]=pr;
	}
}
signed main()
{
	int t;
	cin>>t;
	while (t--)
	{
		ans=-1e15;
		cin>>n>>m;
		for (int i=0;i<m;i++)
			cin>>b[i];
		rec(0);
		cout<<ans<<endl;
	}
}