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

using namespace std;
using namespace __gnu_pbds;
using ll = long long;

template <class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

void solve() {
    int n, m;
    cin >> n >> m;

    vector <int> x(m);
    for (int i = 0; i < m; i++) {
        cin >> x[i];
    }
    
    ll ans = -1e18;
    for (int bit = 0; bit < (1 << m); bit++) {
        ll cur = 0;
        bool now = 1;
        bool now1 = 1;
        for (int i = m-1; i >= 0; i--) {
            if ((bit >> i) & 1) {
                if (now) {
                    cur += x[i];
                } else {
                    cur -= x[i];
                }

                now = !now;
            } else {
                if (now1) {
                    cur += x[i];
                } else {
                    cur -= x[i];
                }
                now1 = !now1;
            }
        }

        ans = max(ans, cur);
    }

    cout << ans << '\n';
}

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

    int t; cin >> t;
    
    while (t--) {
        solve();
    }
    
}

/*

*/