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