#include <bits/stdc++.h>
using namespace std;
long long int dp[300005][2];
int32_t main() {
  long long int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    long long int q;
    cin >> q;
    long long int sum = 0;
    long long int a[n + 1];
    for (long long int i = 1; i <= n; i++) {
      cin >> a[i];
    }
    for (long long 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][0], dp[n][1]) << "\n";
  }
}
