#include <bits/stdc++.h>
using namespace std;
const int maxn = 300000 + 50;
const int maxm = 100000 + 100;
const long long unit = 1LL;
const int INF = 0x3f3f3f3f;
const long long Inf = 0x3f3f3f3f3f3f3f3fLL;
const double eps = 1e-8;
const double inf = 1e15;
const double pi = acos(-1.0);
const long long mod = 1000000007LL;
inline long long read() {
  long long x = 0;
  bool t = false;
  char ch = getchar();
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') t = true, ch = getchar();
  while (ch <= '9' && ch >= '0') x = x * 10 + ch - 48, ch = getchar();
  return t ? -x : x;
}
long long n, q;
long long a[maxn], dp[maxn][2];
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    scanf("%lld%lld", &n, &q);
    for (long long i = 1; i <= n; ++i) scanf("%lld", &a[i]);
    dp[1][0] = a[1], dp[1][1] = 0;
    long long Max0 = a[1], Max1 = 0;
    for (long long i = 2; i <= n; ++i) {
      dp[i][0] = Max1 + a[i];
      dp[i][1] = Max0 - a[i];
      long long tmp1 = Max1, tmp0 = Max0;
      Max1 = max(tmp1, dp[i][1]), Max0 = max(tmp0, dp[i][0]);
    }
    printf("%lld\n", max(Max0, Max1));
  }
  return 0;
}
