#include <bits/stdc++.h>
using namespace std;
long long rec(long long index, vector<long long> &v, long long ad,
              vector<vector<long long> > &dp) {
  if (index == v.size()) return 0;
  long long x = 0;
  if (ad == 1) x = 1;
  if (dp[index][x] != INT_MIN) return dp[index][x];
  long long a = v[index] * ad + rec(index + 1, v, -1 * ad, dp);
  long long b = rec(index + 1, v, ad, dp);
  return dp[index][x] = max(a, b);
}
void solve() {
  long long n, q;
  cin >> n >> q;
  vector<long long> v(n);
  for (long long i = 0; i < n; i++) cin >> v[i];
  vector<vector<long long> > dp(n, vector<long long>(2, INT_MIN));
  long long mx = 0;
  mx = max(mx, rec(0, v, 1, dp));
  cout << mx << endl;
}
int32_t main() {
  long long t = 1;
  cin >> t;
  while (t--) solve();
}
