#include <bits/stdc++.h>
using namespace std;
#define ll long long
void solve() {
    ll n, m;
    cin >> n >> m;
    vector <ll > a(m);
    for (ll i = 0; i < m; i++) {
        cin >> a[i];
    }
    vector <ll > b(n);
    ll g = min(n, m);
    for (ll i = 0; i < g; i++) {
        b[i] += a[i];
    }

    for (ll i = g; i < m; i++) {
        b[0] = a[i] - b[0];
    }
    ll sm = 0;
    for (ll i = 0; i < n; i++) {
        sm += b[i];
    }
    cout << sm << endl;
}
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll z; cin >> z; while(z--)
    solve();
    return 0;
}
