#include <bits/stdc++.h>
using namespace std;
int n, q;
long long a[300001];
long long solve() {
  long long res = 0;
  long long oddMax = 0;
  long long evenMax = 0;
  for (int i = 0; i < n; i++) {
    long long oldOdd = oddMax;
    oddMax = max(oddMax, evenMax + a[i]);
    evenMax = max(evenMax, oldOdd - a[i]);
  }
  return oddMax;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    cin >> n >> q;
    for (int i = 0; i < n; i++) cin >> a[i];
    cout << solve() << endl;
  }
  return 0;
}
