#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 10;
long long a[N];
long long f[N][3];
long long n, m;
int main() {
  long long T;
  cin >> T;
  while (T--) {
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
      cin >> a[i];
      f[i][0] = a[i];
      f[i][1] = 0;
    }
    for (int i = 1; i <= n; i++) {
      f[i][0] = max(max(f[i][0], f[i - 1][1] + a[i]), f[i - 1][0]);
      f[i][1] = max(f[i - 1][0] - a[i], f[i - 1][1]);
    }
    cout << max(f[n][0], f[n][1]) << endl;
    ;
  }
  return 0;
}
