#include <bits/stdc++.h>
using namespace std;
long long dp[300010][2];
long long a[300010];
int main() {
  int T;
  cin >> T;
  while (T--) {
    int n, q;
    cin >> n >> q;
    memset(dp, 0, sizeof(dp));
    for (int i = 0; i < n; i++) cin >> a[i];
    dp[0][0] = a[0];
    for (int i = 1; i < n; i++) {
      dp[i][0] = max(dp[i - 1][0], dp[i - 1][1] + a[i]);
      dp[i][1] = max(dp[i - 1][1], dp[i - 1][0] - a[i]);
    }
    cout << max(dp[n - 1][0], dp[n - 1][1]) << endl;
  }
  return 0;
}
