#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define all(a) a.rbegin(), a.rend()
void solve() {
    int n, m;
    cin >> n >> m;
    vector<ll> x(m);
    for (auto &i : x) cin >> i;
    ll ans = 0;
    for (int mask = 0; mask < (1 << m); ++mask) {
        ll a = 0, b = 0;
        for (int j = 0; j < m; ++j) {
            if ((mask >> j) & 1) {
                a = x[j] - a;
            } else {
                b = x[j] - b;
            }
        }
        ans = max(ans, a + b);
    }
    cout << ans << '\n';
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    cin >> t;
    while (t--) {
        solve();
    }
}
