#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <unordered_map>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <random>

#define all(v) v.begin(), v.end()
#define len(v) (int)v.size()

//using namespace __gnu_pbds;
using namespace std;
using ll = long long;
using ld = long double;
//using ordered_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;

const ll INF = 1e18;
const int Max = 10;
ll ans;
int n, m;
vector<ll> x;
int enda, endb;

void make(int pos, ll a, ll b, int cnta, int cntb)
{
    if (pos == m)
    {
        if ((enda != cnta && endb != cntb) || (enda != cnta && endb != cntb))
        {
            ans = max(ans, a + b);
        }
        return;
    }
    make(pos + 1, x[pos] - a, b, 1 - cnta, cntb);
    //if (cnta != cntb)
    {
        make(pos + 1, a, x[pos] - b, cnta, 1 - cntb);
    }
}

void solve()
{
    cin >> n >> m;
    x.assign(m, 0);
    for (int i = 0; i < m; ++i)
    {
        cin >> x[i];
    }
    vector<ll> a(n, 0);
    ans = -INF;
    for (int i = 0; i < 2; ++i)
    {
        int j = (m - i + 2) % 2;
        enda = i;
        endb = j;
        make(0, 0, 0, i, j);
    }
    cout << ans << '\n';
}

int main()
{
    cin.tie(0)->sync_with_stdio(0);
    int t;
    cin >> t;
    while (t--)
    {
        solve();
    }

    return 0;
}
