#include <bits/stdc++.h>

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using vi = vector<int>;
using vii = vector<pair<int, int>>;
using vc = vector<char>;
using vb = vector<bool>;
template<typename T>
using ve = vector<T>;
template<typename T1, typename T2>
using pr = pair<T1, T2>;

const int INF = 1e9 + 1;
const long long INFLL = 1e18 + 1;
const int MOD = 1e9 + 7;

inline void fchmin(int &a, int &b) { a = min(a, b); }
inline void fchmax(int &a, int &b) { a = max(a, b); }

template<typename T>
inline bool chmin(T &a, T &b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template<typename T>
inline bool chmax(T &a, T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

// #include<ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// using oset = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;

int reps = 1;

void solve() {
    int n, m; cin >> n >> m;
    vi a(m);
    for (int i = 0; i < m; i++) cin >> a[i];
    int ans = -INFLL;
    for (int mask = 0; mask < (1LL << m); mask++) {
        int x = 0, y = 0;
        for (int j = 0; j < m; j++) {
            if ((1LL << j) & mask) x = a[j] - x;
            else y = a[j] - y;
        }
        ans = max(ans, x + y);
    }
    cout << ans << '\n';
}

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    #ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    cin >> reps;

    for (int i = 1; i <= reps; i++) {
        #ifdef LOCAL
        cout << "===== Test #" << i << " ========\n";
        #endif
        solve();
        #ifdef LOCAL
        cout << "==== End test =====\n\n";
        #endif
    }
}