#include <bits/stdc++.h>

using namespace std;

int main() {
    int t;
    cin >> t;
    while (t != 0) {
        int n, m;
        cin >> n >> m;
        vector<long long> a(m);
        for (int i = 0; i < m; i++) {
            cin >> a[i];
        }
        if (n == 1) {
            long long ans = 0;
            for (int i = 0; i < m; i++) {
                ans = a[i] - ans;
            }
            cout << ans << "\n";
        } else {
        long long ans = 0;
        for (int i = 0; i < (1ll<<m); i++) {
            __int128 x1 = 0, x2 = 0;
            for (int j = 0; j < m; j++) {
                if ((i >> j) & 1) {
                    x1 = a[j] - x1;
                } else {
                    x2 = a[j] - x2;
                }
            }
            ans = max(ans, x1 + x2);
        }
        cout << ans << "\n";
        }
        t--;
    }
}



