#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long INFLL = 1e18;
const int MOD = 1e9 + 7;
const int MAXN = 3e5 + 5;
long long dp[MAXN][2];
int a[MAXN];
int n, q;
long long f(int i, bool pos) {
  if (i == n) return 0;
  if (dp[i][pos] != INFLL) return dp[i][pos];
  return dp[i][pos] =
             max(f(i + 1, pos), f(i + 1, pos ^ 1) + a[i] * (pos ? 1 : -1));
}
int main() {
  for (int i = 0; i < (int)MAXN; i++) dp[i][0] = dp[i][1] = INFLL;
  int t;
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &n), scanf("%d", &q);
    for (int i = 0; i < (int)n; i++) dp[i][0] = dp[i][1] = INFLL;
    for (int i = 0; i < (int)n; i++) scanf("%d", &a[i]);
    printf("%lld\n", f(0, true));
  }
  return 0;
}
