#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <set>
#include <map>

#pragma GCC optimize("O3")

#define out(x) std::cout << x << ' ';
#define oute(x) std::cout << x << '\n';
#define enter std::cout << '\n';
#define debout(x) std::cout << #x << x << '\n';
#define debvout(x) std::cout << #x << " : "; for (auto i: x) std::cout << x << ' '; std::cout << '\n';
#define all(x) x.begin(), x.end()
using ll = long long;

std::vector<ll> a, x;
ll ans;

void rec(ll i, ll sum) {
    if (i == x.size()) {
        ans = std::max(ans, sum);
        return;
    }
    ll tmp = sum;
    sum -= a[0];
    a[0] = x[i] - a[0];
    sum += a[0];
    rec(i + 1, sum);
    a[0] = x[i] - a[0];
    sum = tmp;
    sum -= a[1];
    a[1] = x[i] - a[1];
    sum += a[1];
    rec(i + 1, sum);
    a[1] = x[i] - a[1];
}

void s1nmeee() {
    ll n, q;
    std::cin >> n >> q;
    ans = -1e18;
    a.assign(n, 0), x.assign(q, 0);
    for (ll& i : x) std::cin >> i;
    rec(0, 0);
    oute(ans)
}

signed main() {
    std::cin.tie(nullptr), std::ios::sync_with_stdio(false);
    ll TT = 1;
    std::cin >> TT;
    while (TT--) {
        s1nmeee();
        std::cout << '\n';
    }
}