#include <bits/stdc++.h>
using namespace std;
int dadsadasda;
const int INF = 0x3f3f3f3f;
const long long LLINF = 1e18;
const int MAXN = 4e5;
int N, Q;
long long A[MAXN];
struct STN {
  void merge(STN& L, STN& R) {}
  void operator=(int a) {}
};
STN ST[4 * MAXN];
void STB(int id = 1, int l = 0, int r = N) {
  if (r - l < 2) {
    ST[id] = A[l];
    return;
  }
  int m = (l + r) >> 1, L = id << 1, R = L | 1;
  STB(L, l, m);
  STB(R, m, r);
  ST[id].merge(ST[L], ST[R]);
}
STN STQ(int x, int y, int id = 1, int l = 0, int r = N) {
  if (x == l && y == r) return ST[id];
  int m = (l + r) >> 1, L = id << 1, R = L | 1;
  if (x >= m) return STQ(x, y, R, m, r);
  if (y <= m) return STQ(x, y, L, l, m);
  STN res, ln = STQ(x, m, L, l, m), rn = STQ(m, y, R, m, r);
  return res.merge(ln, rn), res;
}
void STU(int p, int x, int id = 1, int l = 0, int r = N) {
  if (r - l < 2) {
    ST[id] = x;
    return;
  }
  int m = (l + r) >> 1, L = id << 1, R = L | 1;
  if (p < m)
    STU(p, x, L, l, m);
  else
    STU(p, x, R, m, r);
  ST[id].merge(ST[L], ST[R]);
}
void solve() {
  dadsadasda = scanf("%d %d", &N, &Q);
  for (int i = 0; i < N; i++) dadsadasda = scanf("%lld", &A[i]);
  long long dp[2] = {A[0], -A[0]};
  for (int i = 1; i < N; i++) {
    long long new_dp[2] = {A[i], -A[i]};
    new_dp[0] = max({new_dp[0], new_dp[0] + dp[1], dp[0]});
    new_dp[1] = max({new_dp[1], new_dp[1] + dp[0], dp[1]});
    dp[0] = new_dp[0];
    dp[1] = new_dp[1];
  }
  printf("%lld\n", max(dp[0], dp[1]));
}
int main() {
  int t;
  dadsadasda = scanf("%d", &t);
  while (t--) solve();
  return 0;
}
