#include <bits/stdc++.h>
using namespace std;
ifstream fin("AAtest.in.txt");
long long n, t, a[300005], v1[300005], v2[300005], q;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cerr.tie(0);
  cin >> t;
  while (t--) {
    cin >> n >> q;
    for (int i = 0; i < n; i++) cin >> a[i];
    v1[0] = a[0];
    v2[0] = 0;
    for (int i = 1; i < n; i++)
      v1[i] = max(v1[i - 1], v2[i - 1] + a[i]),
      v2[i] = max(v2[i - 1], v1[i - 1] - a[i]);
    cout << max(v1[n - 1], v2[n - 1]) << "\n";
  }
}
