#include <bits/stdc++.h>

using namespace std;
using ll = long long;

constexpr ll inf = (ll) (5e18);

void solve() {
    int n, m;
    cin >> n >> m;
    vector<int> x(m);
    ll sum = 0;
    for (int i = 0; i < m; i++) {
        cin >> x[i];
        sum += x[i];
        x[i] *= 2;
    }
    ranges::reverse(x);
    vector<ll> dp(n + 1, -inf);
    dp[n] = 0;
    for (int i = 0; i < m; i++) {
        auto old = dp;
        ranges::fill(dp, -inf);
        for (int plus = 0; plus <= n; plus++) {
            int minus = n - plus;
            if (plus + 1 <= n) {
                dp[plus + 1] = max(dp[plus + 1], old[plus] - x[i]);
            }
            if (minus + 1 <= n) {
                dp[plus - 1] = max(dp[plus - 1], old[plus]);
            }
        }
    }
    cout << *ranges::max_element(dp) + sum << '\n';
}

int main() {
#ifdef home
    freopen("f.in", "r", stdin);
    freopen("f.out", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}
