#include <bits/stdc++.h>

using namespace std;
#define int long long
using pii = pair<int, int>;
using ll = long long;

int inf = 1e18;
int ans = 0;
vector <int> a;
void dfs(int first, int second, int n, int m, int cnt){
    if (cnt == m){
        ans = max(ans, first + second);
        return ;
    }
    dfs(a[cnt] - first, second, n, m, cnt + 1);
    dfs(first, a[cnt] - second, n, m, cnt + 1);
}
void solve(){
    int n, m;
    cin >> n >> m;
    a.resize(m);
    for (int i = 0; i < m; i++){
        cin >> a[i];
    }

    if (n == 1){
        int ans = 0;
        for (int i = 0; i < m; i++){
            ans = a[i] - ans;
        }
        cout << ans << '\n';
        return;
    }
    else {
        ans = -inf;
        dfs(0, 0, n, m, 0);
        cout << ans << '\n';
    }
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int tt = 1;
    cin >> tt;
    while (tt--) {
        solve();
    }
    return 0;
}
