#include <bits/stdc++.h>
using namespace std;
long long gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return (a / gcd(a, b)) * b; }
long long dp[2][300005];
int X[4] = {-1, 1, 0, 0};
int Y[4] = {0, 0, -1, 1};
long long func(long long idx, long long n, long long choose, long long a[]) {
  if (idx >= n) return 0;
  if (dp[choose][idx] != -1) return dp[choose][idx];
  if (choose) {
    return dp[choose][idx] =
               max(a[idx] + func(idx + 1, n, 0, a), func(idx + 1, n, 1, a));
  } else {
    return dp[choose][idx] =
               max(-a[idx] + func(idx + 1, n, 1, a), func(idx + 1, n, 0, a));
  }
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL);
  int t = 1;
  cin >> t;
  while (t--) {
    long long n, m;
    cin >> n >> m;
    memset(dp, -1, sizeof(dp));
    long long a[n];
    for (int i = 0; i < n; i++) cin >> a[i];
    long long ans = func((long long)0, n, (long long)1, a);
    cout << ans << endl;
  }
}
