#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("unroll-loops")
// #include<ext/pb_ds/assoc_container.hpp>
// #include<ext/pb_ds/tree_policy.hpp>
// #pragma GCC target("avx2")
#include<bits/stdc++.h>
// using namespace __gnu_pbds;
using namespace std;
using ll = long long;
// using ordered_map = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
// using hash_map = gp_hash_table<int, int>;
#define watch(x) cout << #x << ": " << x << '\n';
#define watch_arr(arr) cout << #arr << ": "; \
for (int i = 0; i < (int)arr.size(); ++i) { \
    cout << arr[i] << ' '; \
} \
cout << '\n';
#define all(arr) arr.begin(), arr.end()

random_device rd;
mt19937 rnd(rd());

const ll INF = 1e18;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int t;
    cin >> t;
    for (int _ = 0; _ < t; ++_) {
        int n, m;
        cin >> n >> m;
        vector<int> arr(m);
        for (auto& el : arr) {
            cin >> el;
        }
        reverse(all(arr));

        if (arr[0] >= 0) {
            if (m <= n) {
                cout << arr[0] * m << '\n';
            } else {
                cout << arr[0] * (n - (m - n) % 2) << '\n';
            }
        } else {
            cout << arr[0] * (m % 2) << '\n';
        }
    }

    return 0;
}
