#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<stack>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>

using namespace std;
using ll = long long int;
using ld = long double;

void solve() {
    int n, m;
    cin >> n >> m;
    vector<ll> a(m);
    for (int i = 0; i < m; ++i) {
        cin >> a[i];
    }
    if (n == 2) {
        ll mx = 0;
        for (int i = 0; i < (1 << m); ++i) {
            vector<ll> su(2, 0);
            for (int j = 0; j < m; ++j) {
                if ((i >> j) & 1) {
                    su[1] = a[j] - su[1];
                } else {
                    su[0] = a[j] - su[0];
                }
            }
            mx = max(mx, su[1] + su[0]);
        }
        cout << mx << "\n";
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int tt;
    cin >> tt;
    while (tt--) {
        solve();
    }
}