#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    long long q;
    cin >> q;
    long long arr[n];
    for (long long i = 0; i < n; i++) {
      cin >> arr[i];
    }
    long long dp1[n + 1];
    long long dp2[n + 1];
    dp1[0] = INT_MIN;
    dp2[0] = 0;
    for (long long i = 0; i < n; i++) {
      dp1[i + 1] = max(dp1[i], dp2[i] + arr[i]);
      dp2[i + 1] = max(dp2[i], dp1[i] - arr[i]);
    }
    cout << max(dp1[n], dp2[n]) << endl;
  }
  return 0;
}
