#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>

//#pragma GCC Optimize("O3")
//#pragma GCC Optimize("unroll-loops")
//#pragma GCC target("avx,avx2,bmi")

//using namespace __gnu_pbds;
using namespace std;

//template <class T> using ordered_set = tree<T, null_type, less<T> ,rb_tree_tag,tree_order_statistics_node_update>;
//struct h{
//    size_t operator ()(const pair<int,int>& a) const{
//        return ((size_t)a.first << 32) + a.second;
//    }
//};
void solve();

int main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    cin>>t;
    while (t--) {
        solve();
    }
    return 0;
}

#define int long long
#define endl '\n'
const int INF = 2e18;
const int MAXN = 2e5;
const int MOD = 1e9 + 7;



void solve() {
    int n,m;
    cin >> n >> m;
    int ans = -INF;
    vector<int> a(m);
    for (int i = 0; i < m; i++) {
        cin >> a[i];
    }
    for (int mask = 0; mask < (1 << m); mask++) {
        int c1=0,c2=0;
        for (int i = 0; i < m; i++) {
            if (mask & (1 << i)) {
                c1 = a[i]-c1;
            } else {
                c2 = a[i]-c2;
            }
        }
        ans = max(ans, c1 + c2);
    }
    cout << ans << endl;
}
