#include <bits/stdc++.h>
using namespace std;
long long dp[400000][3];
long long fun(long long a[], long long n, long long i, long long f) {
  if (i >= n) return 0;
  if (dp[i][f] != -1) return dp[i][f];
  if (f == 0) {
    return dp[i][f] =
               max(-1 * a[i] + fun(a, n, i + 1, f + 1), fun(a, n, i + 1, f));
  } else {
    return dp[i][f] = max(a[i] + fun(a, n, i + 1, f - 1), fun(a, n, i + 1, f));
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    long long n, q;
    cin >> n >> q;
    long long a[n];
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < 2; j++) {
        dp[i][j] = -1;
      }
    }
    long long ans = fun(a, n, 0, 1);
    cout << ans << "\n";
  }
}
