#include <bits/stdc++.h>

using namespace std;

using ll = long long;

void solve() {
    int n, m;
    cin >> n >> m;
    vector<ll> x(m);
    for (int i = 0; i < m; i++) {
        cin >> x[i];
    }
    vector<int> a(n);
    int i = 0, j = 0;
    while (i < n && j < m) {
        a[i] = x[j];
        i++, j++;
    }
    if (j == m) {
        ll sum = 0;
        for (i = 0; i < n; i++) {
            sum += a[i];
        }
        cout << sum;
        return;
    }
    ll cnt = m - j;
    ll sum = 0;
    for (i = 0; i < n; i++) {
        sum += a[i];
    }
    if (cnt % 2) cout << sum - a[0];
    else cout << sum;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int T = 1;
    cin >> T;
    while (T--) {
        solve();
        cout << '\n';
    }
    return 0;
}
