// tch1cherin GM!
#include <bits/stdc++.h>
using namespace std;

constexpr long long INF = 1e18;

int main() {
  cin.tie(nullptr)->sync_with_stdio(false);
  int t;
  cin >> t;
  while (t--) {
    int n, m;
    cin >> n >> m;
    vector<int> x(m);
    for (int &value : x) {
      cin >> value;
    }
    reverse(x.begin(), x.end());
    vector<long long> dp(n + m + 1, -INF);
    dp[0] = 0;
    for (int j = 0; j < m; j++) {
      for (int i = j + n - 1; i >= j; i--) {
        dp[i + 2] = max(dp[i + 2], dp[i] + x[j]);
      }
    }
    long long total = accumulate(x.begin(), x.end(), 0LL);
    long long max_dp = *max_element(dp.begin() + m, dp.end());
    cout << 2 * max_dp - total << "\n";
  }
}
