    #include <bits/stdc++.h>
    using namespace std;
    using ll = long long;
    using pll = pair<ll,ll>;
    const ll inf = 1e18;
    int main() {
        ll t;
        cin >> t;
        while(t--){
        ll n,m;
        cin >> n >> m;
        vector<ll> a(m);
        for(int i = 0; i < m; i++){
                cin >> a[i];
        }
        set<pll> used;
        used.insert({0,0});
        for(int i = 0; i < m; i++){
                set <pll> nused;
                for(auto v : used){
                    nused.insert({a[i] - v.first,v.second});
                    nused.insert({v.first,a[i] - v.second});
                }
                used = nused;
        }
        ll ans = -inf;
        for(auto v : used){
            ans = max(ans,v.first + v.second);
        }
        cout << ans << '\n';
        }
    }
