#include <bits/stdc++.h>   using namespace std;   int dx[4] = {1, 0, -1, 0};   int dy[4] = {0, 1, 0, -1};   long long n, m, k;   long long arr[300001];   long long arr2[300001];   int main() {     std::ios_base::sync_with_stdio(false);     cin.tie(NULL);     int t;     cin >> t;     cin.ignore();     for (int test_case = 0; test_case < t; ++test_case) {       int flg = 0;       long long ans1 = 0, ans2 = 0;       string ans[3] = { NO ,  YES ,  R };       string s1, s2 =   ;       cin >> n >> k;       for (int i = 0; i < n; ++i) {         cin >> arr[i];       }       int i;       long long mn = 10000000000;       long long mx = 0;       for (i = 0; i < n; ++i) {         if (mn < arr[i]) {           if (mn != 10000000000) {             ans1 += mx - mn;             mx = 0;             mn = 10000000000;           }         }         mx = max(mx, arr[i]);         mn = min(mn, arr[i]);       }       ans1 += mx;       cout << ans1;       cout <<   n ;     }     return 0;   }   