#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n, q;
    cin >> n >> q;
    vector<long long> v(n);
    for (auto &x : v) cin >> x;
    vector<long long> dp1(n), dp2(n);
    dp1[n - 1] = v[n - 1];
    dp2[n - 1] = 0;
    for (int i = n - 2; i >= 0; i--) {
      dp1[i] = max(dp1[i + 1], v[i] + dp2[i + 1]);
      dp2[i] = max(dp2[i + 1], -v[i] + dp1[i + 1]);
    }
    cout << dp1[0] << '\n';
  }
  return 0;
}
