#include <bits/stdc++.h>
using namespace std;
long long ar[300009], aa[300009], n, q;
long long dp[300009][2];
long long fun(long long id, long long tk) {
  if (id == n + 1) return 0;
  if (dp[id][tk] != -1) return dp[id][tk];
  long long x = 0, as = 0;
  if (tk == 0) {
    x = ar[id] + fun(id + 1, tk ^ 1);
    as = max(as, x);
  } else if (tk == 1) {
    x = -1 * ar[id] + fun(id + 1, tk ^ 1);
    as = max(as, x);
  }
  x = 0;
  x = fun(id + 1, tk);
  as = max(as, x);
  return dp[id][tk] = as;
}
int32_t main() {
  long long t;
  cin >> t;
  while (t--) {
    cin >> n >> q;
    for (long long i = 1; i <= n; i++) {
      cin >> ar[i];
      dp[i][0] = -1;
      dp[i][1] = -1;
    }
    long long ans = fun(1, 0);
    cout << ans << endl;
  }
}
