#include <iostream>
#include <vector>
#include <algorithm>
#include <bitset>

using namespace std;
#define int long long
void solve() {

    int k;
    cin >> k;
    int n;
    cin >> n;
    vector<int> a(n);
    for (int &i: a) cin >> i;
    int ans = 0;
    for (int i = 0; i < (1ll << n); ++i) {
        int x = 0, y = 0;
        for (int j = 0; j < n; ++j) {
            if (i & (1ll << j)) {
                x = a[j] - x;
            } else {
                y = a[j] - y;
            }
        }
        if (i == 0 || ans < x + y) {
            ans = x + y;
        }
    }
    cout << ans << '\n';
}
signed main() {
    int t;
    cin >> t;
    while(t--) {
        solve();
    }
    return 0;
}
