#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <ctime>
#include <climits>
#include <iomanip>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <string>
#include <queue>
#include <random>

#define int long long

#pragma GCC optimize("03,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")

using ll = long long;
using ld = long double;
using namespace std;

const ll INF = 1e18;


void solve() {
    int n, m;
    cin >> n >> m;
    vector<int> a(m);
    for (int i = 0; i < m; i++){
        cin >> a[i];
    }
    int mx = -INF;
    for (int mask = 0; mask < (1 << m); mask++){
        vector<int> fir;
        vector<int> sec;
        for (int i = 0; i < m; i++){
            if ((mask >> i) & 1){
                fir.push_back(a[i]);
            } else {
                sec.push_back(a[i]);
            }
        }
        int ans= 0;
        int sz1 = (int)fir.size();
        int sz2 = (int)sec.size();
        for (int i = sz1 - 1; i >= 0; i--){
            if ((sz1 - i) % 2 == 1){
                ans += fir[i];
            } else {
                ans -= fir[i];
            }
        }
        for (int i = sz2 - 1; i >= 0; i--){
            if ((sz2 - i) % 2 == 1){
                ans += sec[i];
            } else {
                ans -= sec[i];
            }
        }
        mx = max(mx, ans);
    }
    cout << mx;
}


signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t;
    cin >> t;
    while (t--){
        solve();
    }
    return 0;
}