#include <bits/stdc++.h>
using namespace std;
long long n, arra[300005], dp[300005][5];
long long rec(int i, int cur) {
  if (i == n) return 0;
  if (dp[i][cur] != -1) return dp[i][cur];
  long long cost1 = 0, cost2 = 0;
  if (cur == 1) {
    cost1 = arra[i] + rec(i + 1, 2);
  } else
    cost1 = -arra[i] + rec(i + 1, 1);
  cost2 = rec(i + 1, cur);
  return dp[i][cur] = max(cost1, cost2);
}
int main() {
  int t, q;
  scanf("%d", &t);
  while (t--) {
    scanf("%lld %d", &n, &q);
    for (int i = 0; i < n; i++) scanf("%lld", &arra[i]);
    for (int i = 0; i <= n; i++) {
      for (int j = 0; j <= 3; j++) dp[i][j] = -1;
    }
    long long a = rec(0, 1);
    printf("%lld\n", a);
  }
  return 0;
}
