#include <bits/stdc++.h>
using namespace std;
mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
const long long INF = INT_MAX;
const long long INF_LL = LLONG_MAX;
const long double EPS = 1e-9;
const long long MOD = 1e9 + 7;
long long n;
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  long long t;
  cin >> t;
  while (t--) {
    long long q;
    cin >> n >> q;
    vector<long long> Num(n), Dp_decr(n, -INF), Dp_incr(n, -INF);
    for (long long i = 0; i < n; ++i) {
      cin >> Num[i];
    }
    Dp_decr[0] = Num[0];
    long long incr_max = 0;
    long long decr_max = Num[0];
    for (long long i = 1; i < n; ++i) {
      Dp_decr[i] = incr_max + Num[i];
      Dp_incr[i] = decr_max - Num[i];
      decr_max = max(decr_max, Dp_decr[i]);
      incr_max = max(incr_max, Dp_incr[i]);
    }
    cout << max(decr_max, incr_max) << "\n";
  }
}
