#include <bits/stdc++.h>
using namespace std;
int B(bool r) {
  if (r)
    return 1;
  else
    return -1;
}
long long int ms(int i, vector<int>& a, bool sumando,
                 vector<vector<long long int>>& memo) {
  if (i >= a.size())
    return 0;
  else if (memo[sumando][i] == -1) {
    long long int res = max(a[i] * B(sumando) + ms(i + 1, a, !sumando, memo),
                            ms(i + 1, a, sumando, memo));
    memo[sumando][i] = res;
  }
  return memo[sumando][i];
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, q;
    cin >> n >> q;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    long long int res = 0;
    vector<vector<long long int>> memo(2, vector<long long int>(n, -1));
    res = ms(0, a, true, memo);
    cout << res << '\n';
  }
  return 0;
}
