#include <bits/stdc++.h>
const int M = 1e9 + 7;
using namespace std;
int binPow(int a, int n) {
  int res = 1;
  while (n) {
    if (n & 1) res = (1LL * res * a) % M;
    a = (1LL * a * a) % M;
    n >>= 1;
  }
  return res;
}
long long int dp[300005][2];
long long int a[300005];
long long int n, q;
long long int solve(long long int index, bool b) {
  if (index >= n) return 0;
  if (dp[index][b] != -1) return dp[index][b];
  long long int a1 = 0, a2 = 0;
  if (b) {
    a1 = a[index] + solve(index + 1, false);
  } else {
    a1 = -a[index] + solve(index + 1, true);
  }
  a2 = solve(index + 1, b);
  return dp[index][b] = max(a1, a2);
}
int main() {
  ios_base::sync_with_stdio(false);
  cout.tie(nullptr);
  long long int t;
  cin >> t;
  while (t--) {
    cin >> n >> q;
    for (int i = 0; i < n; ++i) {
      cin >> a[i];
    }
    memset(dp, -1, sizeof dp);
    cout << solve(0, true) << "\n";
  }
}
