#include <bits/stdc++.h>
using namespace std;
const long long N = 3e5 + 5;
long long dp[N][2];
long long sol(vector<long long> &v, int pos, int f) {
  if (pos >= v.size()) return 0;
  if (dp[pos][f] != -1) return dp[pos][f];
  long long &ans = dp[pos][f];
  ans = 0;
  if (f == 1) {
    ans = max(v[pos] + sol(v, pos + 1, 0), sol(v, pos + 1, 1));
  } else {
    ans = max(-v[pos] + sol(v, pos + 1, 1), sol(v, pos + 1, 0));
  }
  return ans;
}
void solve() {
  long long n, q;
  cin >> n >> q;
  vector<long long> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  for (int i = 0; i <= n + 1; i++) {
    dp[i][0] = -1;
    dp[i][1] = -1;
  }
  cout << sol(v, 0, 1) << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  cin >> t;
  while (t--) solve();
  cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC
       << "ms\n";
  return 0;
}
