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