#include <bits/stdc++.h>
using namespace std;
int T, n, q;
long long a[303030], dp[303030][4];
string s;
long long go(int idx, int type) {
  if (idx == n) return dp[idx][type] = 0;
  if (dp[idx][type] > -1) return dp[idx][type];
  long long ret = 0;
  if (type == 0) {
    ret += a[idx];
    ret += max(go(idx + 1, 1), go(idx + 1, 3));
    return dp[idx][type] = ret;
  } else if (type == 1) {
    ret -= a[idx];
    ret += max(go(idx + 1, 0), go(idx + 1, 2));
    return dp[idx][type] = ret;
  } else if (type == 2) {
    ret += max(go(idx + 1, 0), go(idx + 1, 2));
    return dp[idx][type] = ret;
  } else if (type == 3) {
    ret += max(go(idx + 1, 1), go(idx + 1, 3));
    return dp[idx][type] = ret;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> T;
  while (T--) {
    cin >> n >> q;
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < 4; j++) {
        dp[i][j] = -1;
      }
    }
    cout << max(go(0, 0), go(0, 2)) << "\n";
  }
  return 0;
}
