#include <bits/stdc++.h>
using namespace std;
const int M = 3e5 + 7;
long long a[M];
long long dp[M][3], n;
long long call(int pos, int op) {
  if (pos == n) return 0;
  if (dp[pos][op] != -1) return dp[pos][op];
  long long res = 0;
  if (op == 0) {
    res = max(res, a[pos] + call(pos + 1, op ^ 1));
    res = max(res, call(pos + 1, op));
  } else {
    res = max(res, -a[pos] + call(pos + 1, op ^ 1));
    res = max(res, call(pos + 1, op));
  }
  return dp[pos][op] = res;
}
void solve() {
  int q;
  cin >> n >> q;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 2; j++) dp[i][j] = -1;
  }
  for (int i = 0; i < n; i++) cin >> a[i];
  long long res = call(0, 0);
  cout << res << "\n";
}
int main() {
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
