#include <bits/stdc++.h>
using namespace std;
int main() {
  FILE *inF, *outF;
  inF = fopen("in", "r");
  outF = fopen("out", "w");
  inF = stdin;
  outF = stdout;
  int t;
  fscanf(inF, "%d", &t);
  while (t--) {
    int n, q;
    long long dp[300001][2] = {};
    fscanf(inF, "%d %d", &n, &q);
    for (int i = 1; i <= n; i++) {
      int num;
      fscanf(inF, "%d", &num);
      dp[i][0] = max(dp[i - 1][1] + num, dp[i - 1][0]);
      dp[i][1] = max(dp[i - 1][1], dp[i - 1][0] - num);
    }
    fprintf(outF, "%lld\n", max(dp[n][0], dp[n][1]));
  }
  return 0;
}
