#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <iomanip>
using namespace std;
using ll = long long;
using ld = long double;
#define endl '\n'
void solve() {
	int n, m; cin >> n >> m; vector<ll> x(m);
	for (auto& i : x) cin >> i;
	reverse(x.begin(), x.end());
	ll sum = 0;
	for (auto i : x) sum += i;
	ll res = 0;
	for (int i = 0; i < m; i++) {
		if (i & 1) {
			res -= x[i];
		}
		else {
			res += x[i];
		}
	}
	if (n == 1) {
		cout << res << endl; return;
	}
	int ln = (m - n + 1) / 2;
	sum -= ln * x[0]; cout << sum << endl;
}
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int t; cin >> t;
	while (t--) solve();
	return 0;
}
