#include <bits/stdc++.h>

using namespace std;
#define int int64_t
#define endl '\n'

void solve() {
    int n, m;
    cin >> n >> m;
    vector<int> xs(m);
    for (int& x : xs) cin >> x;
    bool flag = true;
    for (int i = 1; i < n; ++i) flag &= xs[i - 1] == xs[i];
    int ans = 0;
    for (int i = 0; i < min(n, m); ++i) ans += xs[i];
    cout << ans + (max<int>(0, m - n) & 1 ? -xs[0] : 0) << endl;
    return;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int test = 1;
    cin >> test;

    while (test--) {
        solve();
    }

    return 0;
}