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