#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5;
int n, q;
int a[N];
int main() {
  int tt;
  scanf("%d", &tt);
  while (tt--) {
    scanf("%d%d", &n, &q);
    for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
    vector<long long> mn(n + 1), mx(n + 1);
    for (int i = n - 1; i >= 0; --i) {
      mx[i] = max(mx[i + 1], a[i] - mn[i + 1]);
      mn[i] = min(mn[i + 1], a[i] - mx[i + 1]);
    }
    printf("%lld\n", mx[0]);
  }
}
