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

#ifdef LOCAL
#define _GLIBCXX_DEBUG
#else
#pragma GCC optimize("O3,Ofast")
#pragma GCC target("avx2,arch=skylake")
#endif

using namespace std;
using namespace __gnu_pbds;

using ll = long long;

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

void solve();

istream& operator>>(istream& in, __int128& a) {
    ll b;
    in >> b;
    a = b;
    return in;
}

ostream& operator<<(ostream& out, __int128 a) {
    out << (ll)a;
    return out;
}

const int mod = 1e9 + 7;

struct mint {
    int x;
    mint() = default;
    mint(int x) : x(x) {}
    mint operator+(mint b) const { return (x + b.x < mod ? x + b.x : x + b.x - mod); }
    mint operator-(mint b) const { return (x - b.x >= 0 ? x - b.x : x - b.x + mod); }
    mint operator*(mint b) const { return (ll)x * b.x % mod; }
    mint operator+=(mint b) { return x = (x + b.x < mod ? x + b.x : x + b.x - mod); }
    mint operator-=(mint b) { return x = (x - b.x >= 0 ? x - b.x : x - b.x + mod); }
    mint operator*=(mint b) { return x = (ll)x * b.x % mod; }
    mint operator^(int n) {
        if (n == 0) return 1;
        if (n == 1) return x;
        auto mid = operator^(n >> 1);
        if (n & 1) return operator*(mid * mid);
        return mid * mid;
    }
    mint inv() { return operator^(mod - 2); }
    mint operator/(mint b) const { return operator*(b.inv()); }
};

istream& operator>>(istream& in, mint b) {
    in >> b.x;
    return in;
}

ostream& operator<<(ostream& out, mint b) {
    out << b.x;
    return out;
}

#ifndef LOCAL
int seed = chrono::high_resolution_clock::now().time_since_epoch().count();
#else
int seed = 52;
#endif
mt19937 rnd(seed);

int main() {
#ifdef LOCAL
    freopen(R"(input.txt)", "r", stdin);
    freopen(R"(output.txt)", "w", stdout);
#else
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#endif
    int tt = 1;
    cin >> tt;
    cout << fixed << setprecision(15);
    while (tt--){
        solve();
    }
    return 0;
}

#define int ll

inline void solve() {
    int n, m;
    cin >> n >> m;
    vector<int> v(m);
    for (int i = 0; i < m; ++i) {
        cin >> v[i];
    }
    int sum = 0;
    for (int mask = 0; mask < (1 << m); ++mask) {
        int a = 0, b = 0;
        for (int i = 0; i < m; ++i) {
            if (mask & (1 << i)) {
                a = v[i] - a;
            }else{
                b = v[i] - b;
            }
        }
        sum = max(sum, a + b);
    }
    cout << sum << '\n';
}



