#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back

using namespace std;

typedef long long ll;
typedef long double ld;

const ll mod = 1e9+7;

ll bpow(ll a, ll n) {
    ll res = 1;
    while (n) {
        res *= a;
        if (n & 1) a *= a;
        n /= 2;
    }
    return res;
}

const int N = 5e5+52;
const int M = 2e3+52;

ll b[N];
int n,m;
ll mx = 0;
void rec(int pos, int i1,  vector<ll> a) {
    if (pos == m+1) {
        ll ans = 0;
        for (int i = 1; i <= n; i++) {
            ans += a[i];
        }
        mx = max(ans, mx);
        return;
    }
    for (int i = i1; i <= n; i++) {
        ll c = a[i];
        a[i] = b[pos] - a[i];
        rec(pos+1, i1,  a);
        a[i] = c;
        if (c == 0) break;
    }
}

void altay() {
    mx = -1e18;
    cin >> n >> m;
    n = min(n,m);
    for (int i = 1; i <= m; i++) {
        cin >> b[i];
    }
    vector<ll> ve(n+2,0);
    int pos = 1;
//    for (int i = 1; i <= n; i++) {
//        if (pos >= m) break;
//        ve[i] = b[i];
//        pos++;
//    }

    rec(pos,1,ve);
    cout << mx << "\n";

}

int main() {

    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
//    return 0;
    int t = 0;
    cin >> t;
    while (t--) {
        altay();
    }

    return 0;
}
