#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1000000000 + 7;
const long long int MOD1 = 998244353;
const long long int Val9 = 1000000000;
const long long int Val6 = 1000000;
vector<long long int> vd;
void no_of_divisors(long long int n) {
  for (long long int i = 1; i <= sqrt(n); i++) {
    if (n % i == 0) {
      if (n / i == i) {
        vd.push_back(i);
      } else {
        vd.push_back(i);
        vd.push_back(n / i);
      }
    }
  }
}
long long int pwr(long long int x, long long int y) {
  long long int r = 1;
  while (y > 0) {
    if (y & 1) r = r * x;
    x *= x;
    y >>= 1;
  }
  return r;
}
long long int pwrm(long long int x, long long int y, long long int m) {
  x %= m;
  long long int r = 1;
  while (y > 0) {
    if (y & 1) r = r * x % m;
    x = x * x % m;
    y >>= 1;
  }
  return r;
}
int isPrime(long long int n) {
  if (n <= 1) return 0;
  if (n <= 3) return 1;
  if (n % 2 == 0 || n % 3 == 0) return 0;
  for (int i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return 0;
  return 1;
}
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
vector<long long int> vprime;
vector<long long int> vsqr;
void SieveOfEratosthenes(long long int n) {
  bool prime[n + 1];
  memset(prime, true, sizeof(prime));
  for (long long int p = 2; p * p <= n; p++) {
    if (prime[p] == true) {
      for (long long int i = p * p; i <= n; i += p) prime[i] = false;
    }
  }
  for (long long int p = 2; p <= n; p++) {
    if (prime[p]) {
      vprime.push_back(p);
      vsqr.push_back(p * p);
    }
  }
}
bool vis[Val6] = {false};
vector<long long int> v[Val6];
vector<long long int> ans1;
long long int dfs(long long int s) {
  long long int p = v[s].size();
  ans1.push_back(s);
  vis[s] = true;
  for (long long int i = (long long int)0; i < (long long int)v[s].size();
       i++) {
    if (vis[v[s][i]] == false) {
      dfs(v[s][i]);
    }
  }
  return 1;
}
void bfs(vector<long long int> v[], long long int n) {
  queue<long long int> q;
  q.push(n);
  vis[n] = true;
  long long int dist = 0;
  while (!q.empty()) {
    long long int p = q.front();
    q.pop();
    dist++;
    for (long long int i = (long long int)0; i < (long long int)v[p].size();
         i++) {
      if (vis[v[p][i]] == false) {
        q.push(v[p][i]);
        vis[v[p][i]] = true;
      }
    }
  }
}
long long int nCr(long long int n, long long int r) {
  long long int ans = 1;
  for (long long int i = (long long int)0; i < (long long int)r; i++) {
    ans *= n - i;
    ans /= i + 1;
  }
  return ans;
}
long long int n;
long long int a[Val6], b[Val6];
long long int dp[3 * 100000 + 1][2];
long long int fun(long long int s, long long int c) {
  if (s == n) return 0;
  if (dp[s][c] != -1) return dp[s][c];
  if (c == 0) {
    return dp[s][c] = max(a[s] + fun(s + 1, 1), fun(s + 1, 0));
  } else {
    return dp[s][c] = max(fun(s + 1, 0) - a[s], fun(s + 1, 1));
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long int T;
  cin >> T;
  while (T--) {
    cin >> n;
    long long int q;
    cin >> q;
    for (long long int i = (long long int)0; i < (long long int)n; i++)
      cin >> a[i];
    for (long long int i = (long long int)0; i < (long long int)n + 1; i++) {
      dp[i][0] = -1;
      dp[i][1] = -1;
    }
    cout << fun(0, 0) << "\n";
  }
  cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC
       << "ms\n";
  return 0;
}
