#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n, i, j, q;
    cin >> n >> q;
    long long ar[n + 1];
    for (i = 1; i <= n; i++) {
      cin >> ar[i];
    }
    long long ans = ar[1];
    long long dp[n + 2];
    memset(dp, 0, sizeof(dp));
    for (i = 2; i <= n; i++) {
      ans = max(ans, ar[i] + dp[i - 1]);
      if (ar[i] < ar[i - 1])
        dp[i] = dp[i - 1] + ar[i - 1] - ar[i];
      else
        dp[i] = dp[i - 1];
    }
    cout << ans << "\n";
  }
}
