
#include<bits/stdc++.h>

#define int long long
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin() , x.rend()
#define f first
#define second

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using pi = pair<int , int>;
using vpi = vector<pi>;


const int mod = 1e9 + 7;

ll summ(int a , int b , const int &mod) {
    return ((a + b) % mod + mod) % mod;
}
ll mn(int a , int b , const int &mod) {
    return ((a - b) % mod + mod) % mod;
}
ll umn(int a , int b , const int &mod) {
    return ((a * b) % mod + mod) % mod;
}
int binpow(int a , int p) {
    if (p == 0) return 1;
    if (p & 1) {
        return umn(a , binpow(a , p - 1) , mod);
    } else {
        int x = binpow(a , p / 2);
        return umn(x , x , mod);
    }
}

int del(int a , int b , const int &mod) {
    return umn(a , binpow(b , mod - 2) , mod);
}

struct node {
    int ans , cnt , mx , pos;
};
bool operator<(const node a , const node b) {
    return ((a.mx == b.mx ? a.pos < b.pos : a.mx < b.mx));
}

struct pope {
    int x , ind;
};

void solve() {
    int n , m;
    cin >> n >> m;
    vector<int> x(m);
    for(int i = 0 ; i < m ; i++) {
        cin >> x[i];
    }
    int mx = 0;
    for(int i = 0 ; i < (1 << m) ; i++) {
        bitset<18> z(i);
        int a = 0 ,b = 0;
        for(int j =  0; j < m ; j++) {
            if(z[j]) {
                a = x[j] - a;
            } else {
                b = x[j] - b;
            }
        }
        mx = max(mx , a + b);
    }
    cout << mx << '\n';
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin >> t;
    while(t--)
        solve();
}


