#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int mod = 998244353;
const double pi = 3.14159265359;
void skrrrt() { ios_base::sync_with_stdio(0), cin.tie(0); }
int n, q, a[300009];
int id = 1;
long long mem[300009][2];
int vis[300009][2];
long long solve(int ind = 0, int f = 0) {
  if (ind >= n) return 0;
  long long &ret = mem[ind][f];
  if (vis[ind][f] == id) return ret;
  vis[ind][f] = id;
  ret = solve(ind + 1, f);
  if (f == 0)
    ret = max(ret, a[ind] + solve(ind + 1, !f));
  else
    ret = max(ret, solve(ind + 1, !f) - a[ind]);
  return ret;
}
int main() {
  skrrrt();
  int t;
  cin >> t;
  while (t--) {
    cin >> n >> q;
    for (int i = 0; i < n; i++) cin >> a[i];
    cout << solve() << "\n";
    id++;
  }
}
