#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5;
int n, q;
int a[N];
long long dp[N][2];
int main() {
  int T;
  cin >> T;
  while (T--) {
    memset(dp, 0, sizeof dp);
    scanf("%d%d", &n, &q);
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
    }
    dp[1][0] = a[1];
    for (int i = 2; 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]);
    }
    printf("%lld\n", max(dp[n][0], dp[n][1]));
  }
  return 0;
}
