#include <bits/stdc++.h>
using namespace std;
void swap(long long int &x, long long int &y) {
  x = x ^ y;
  y = x ^ y;
  x = x ^ y;
}
template <typename T>
void print(T a) {
  for (auto i = a.begin(); i != a.end(); i++) cout << *i << " ";
  cout << endl;
}
bool isVowel(char c) {
  if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') return true;
  return false;
}
void sync() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
long long int stockBuySell(long long int price[], long long int n) {
  if (n == 1) return price[0];
  long long int i = 0;
  long long int ans = 0, ans1 = 0;
  while (i < n) {
    while ((i < n - 1) && (price[i + 1] >= price[i])) i++;
    long long int buy = i;
    ans += price[buy];
    ans1 = max(ans1, ans);
    i++;
    if (i == n) break;
    while ((i < n) && (price[i] <= price[i - 1])) i++;
    long long int sell = i - 1;
    ans -= price[sell];
    ans1 = max(ans1, ans);
  }
  ans1 = max(ans1, ans);
  return ans1;
}
int main() {
  sync();
  long long int t;
  cin >> t;
  for (long long int testcase = 1; testcase <= t; testcase++) {
    long long int n, q;
    cin >> n >> q;
    long long int a[n];
    for (long long int i = 0; i < n; i++) cin >> a[i];
    cout << stockBuySell(a, n) << endl;
  }
}
