#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 10;
int t, n, a[maxn], q;
long long dp[maxn][2];
int main() {
  scanf("%d", &t);
  for (int Case = 1; Case <= t; Case++) {
    scanf("%d%d", &n, &q);
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    dp[0][0] = dp[0][1] = 0;
    long long pre0 = 0, pre1 = 0;
    for (int i = 1; i <= n; i++) {
      dp[i][0] = pre1 + a[i];
      dp[i][1] = pre0 - a[i];
      pre0 = max(pre0, dp[i][0]);
      pre1 = max(pre1, dp[i][1]);
    }
    printf("%lld\n", pre0);
  }
  return 0;
}
