#include <bits/stdc++.h>
#define int long long
using namespace std;

int popcount(int n){
    return __builtin_popcount(n);
}

void solve(){
    int n, m; cin >> n >> m;
    deque<int>spis(m, 0);
    for(auto &i:spis) cin >> i;
    int ans = -99999999999999999;
    for (int mask = 0; mask < (1<<m); mask++){

        int fir = 0;
        int f = 1;
        int sec = 0;
        int s = 1;
        for(int i =0; i<m; i++){
            if (mask & (1<<i)){
                fir+=f*spis[m-1-i];
                if (f==1) f = -1;
                else f = 1;
            }
            else{
                sec+=s*spis[m-1-i];
                if (s==-1) s = 1;
                else s = -1;
            }
        }
        ans = max(ans, fir+sec);
    }
    cout << ans <<"\n";
}


signed main() {
    int t=1;
    cin >> t;
    while(t--){
        solve();
    }

    return 0;
}






