#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int T, N, Q;
  cin >> T;
  while (T--) {
    cin >> N >> Q;
    vector<int> V(N);
    for (int i = 0; i < N; i++) cin >> V[i];
    vector<pair<long long, long long>> dp(N, {0, 0});
    dp[N - 1] = make_pair(V[N - 1], 0);
    for (int i = N - 2; i >= 0; i--) {
      dp[i].first = max(dp[i + 1].first, dp[i + 1].second + V[i]);
      dp[i].second = max(dp[i + 1].second, dp[i + 1].first - V[i]);
    }
    cout << dp[0].first << endl;
  }
  return 0;
}
