Problem: This is the easy version of the problem. The difference between the versions is that the easy version has no swap operations. You can make hacks only if all versions of the problem are solved.

Pikachu is a cute and friendly pokémon living in the wild pikachu herd.

But it has become known recently that infamous team R wanted to steal all these pokémon! Pokémon trainer Andrew decided to help Pikachu to build a pokémon army to resist.

First, Andrew counted all the pokémon — there were exactly n pikachu. The strength of the i-th pokémon is equal to a_i, and all these numbers are distinct.

As an army, Andrew can choose any non-empty subsequence of pokemons. In other words, Andrew chooses some array b from k indices such that 1 ≤ b_1 < b_2 < ... < b_k ≤ n, and his army will consist of pokémons with forces a_{b_1}, a_{b_2}, ..., a_{b_k}.

The strength of the army is equal to the alternating sum of elements of the subsequence; that is, a_{b_1} - a_{b_2} + a_{b_3} - a_{b_4} + ....

Andrew is experimenting with pokémon order. He performs q operations. In i-th operation Andrew swaps l_i-th and r_i-th pokémon.

Note: q=0 in this version of the task.

Andrew wants to know the maximal stregth of the army he can achieve with the initial pokémon placement. He also needs to know the maximal strength after each operation.

Help Andrew and the pokémon, or team R will realize their tricky plan!

Input

Each test contains multiple test cases.

The first line contains one positive integer t (1 ≤ t ≤ 10^3) denoting the number of test cases. Description of the test cases follows.

The first line of each test case contains two integers n and q (1 ≤ n ≤ 3 ⋅ 10^5, q = 0) denoting the number of pokémon and number of operations respectively.

The second line contains n distinct positive integers a_1, a_2, ..., a_n (1 ≤ a_i ≤ n) denoting the strengths of the pokémon.

i-th of the last q lines contains two positive integers l_i and r_i (1 ≤ l_i ≤ r_i ≤ n) denoting the indices of pokémon that were swapped in the i-th operation.

It is guaranteed that the sum of n over all test cases does not exceed 3 ⋅ 10^5, and the sum of q over all test cases does not exceed 3 ⋅ 10^5. 

Output

For each test case, print q+1 integers: the maximal strength of army before the swaps and after each swap.

Example

Input


3
3 0
1 3 2
2 0
1 2
7 0
1 2 5 4 3 6 7


Output


3
2
9

Note

In third test case we can build an army in such way: [1 2 5 4 3 6 7], its strength will be 5−3+7=9.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  int f = 0;
  cerr << '{';
  for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
inline long long int GCD(long long int x, long long int y) {
  if (x < y) swap(x, y);
  if (x == 0) return y;
  if (y == 0) return x;
  return GCD(x % y, y);
}
long long int phi(long long int n) {
  long long int result = n;
  for (long long int i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      while (n % i == 0) n /= i;
      result -= result / i;
    }
  }
  if (n > 1) result -= result / n;
  return result;
}
long long int power(long long int x, long long int n, long long int mod) {
  long long int res = 1;
  x %= mod;
  while (n) {
    if (n & 1) {
      res = ((res * x) % mod + mod) % mod;
    }
    x = ((x * x) % mod + mod) % mod;
    n >>= 1;
  }
  return res;
}
const int MAXN = 3e5 + 5;
long long int N;
long long int tree[4 * MAXN][4], A[MAXN];
inline void merge(long long int ans[4], long long int left[4],
                  long long int right[4]) {
  ans[0] = max(left[0], right[0]);
  ans[0] = max(ans[0], left[1] - right[3]);
  ans[0] = max(ans[0], left[0] + right[0]);
  ans[1] = max(left[1], right[1]);
  ans[1] = max(ans[1], left[1] - right[2]);
  ans[1] = max(ans[1], left[0] + right[1]);
  ans[3] = min(left[3], right[3]);
  ans[3] = min(ans[3], left[3] - right[0]);
  ans[3] = min(ans[3], left[2] + right[3]);
  ans[2] = min(left[2], right[2]);
  ans[2] = min(ans[2], left[3] - right[1]);
  ans[2] = min(ans[2], left[2] + right[2]);
}
void build(long long int node, long long int start, long long int end) {
  if (start == end) {
    tree[node][0] = 0;
    tree[node][1] = A[start];
    tree[node][2] = 0;
    tree[node][3] = A[start];
  } else {
    long long int mid = (start + end) / 2;
    build(2 * node, start, mid);
    build(2 * node + 1, mid + 1, end);
    merge(tree[node], tree[2 * node], tree[2 * node + 1]);
  }
}
void update(long long int node, long long int start, long long int end,
            long long int l, long long int r, long long int val) {
  if (start > end || l > end || r < start) return;
  if (l <= start && end <= r) {
    tree[node][0] = 0;
    tree[node][1] = val;
    tree[node][2] = 0;
    tree[node][3] = val;
    return;
  }
  long long int mid = (start + end) / 2;
  if (l <= mid) update(2 * node, start, mid, l, r, val);
  if (mid + 1 <= r) update(2 * node + 1, mid + 1, end, l, r, val);
  merge(tree[node], tree[2 * node], tree[2 * node + 1]);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int Q;
  long long int test;
  cin >> test;
  while (test--) {
    cin >> N >> Q;
    for (long long int i = 1; i <= N; i++) {
      cin >> A[i];
    }
    build(1, 1, N);
    long long int ans = max(tree[1][0], tree[1][1]);
    cout << ans << endl;
    long long int l, r;
    while (Q--) {
      cin >> l >> r;
      swap(A[l], A[r]);
      update(1, 1, N, l, l, A[l]);
      update(1, 1, N, r, r, A[r]);
      long long int ans = max(tree[1][0], tree[1][1]);
      cout << ans << endl;
    }
  }
}