#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, q;
  cin >> n >> q;
  long long a[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long max1 = 0, min1 = 0;
  for (long long i = n - 1; i >= 0; i--) {
    long long j = a[i];
    long long l1 = max(max1, a[i] - min1);
    long long l2 = min(min1, a[i] - max1);
    max1 = l1;
    min1 = l2;
  }
  cout << max1 << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
