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