#include<bits/stdc++.h>
//#pragma GCC target("avx2")
#define int long long
#define F first
#define S second

using namespace std;

const int N = 5e5+10;

bool us[N];

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cout.tie(0);
    cin.tie(0);
    int t;
    cin>>t;
    while(t--)
    {
        int n, m;
        cin>>n>>m;
        int p[m+10];
        for(int i = 1; i <= m; i++)
        {
            int x;
            cin>>x;
            p[i] = x;
        }
        if(n == 1)
        {
            int ans = 0;
            for(int i = 1; i <= m; i++)
            {
                if((i%2)) ans += p[i];
                else ans -= p[i];
            }
            cout<<-ans<<"\n";
            continue;
        }
        int ans = -2e18;
        for(int ms = 0; ms < (1<<m); ms++)
        {
            int sum = 0, x = 0, y = 0;
            for(int b = 0; b < m; b++)
            {
                if(ms&(1<<b))
                    x = p[b+1]-x;
                else
                    y = p[b+1]-y;
            }
            ans = max(ans, x+y);
        }
        cout<<ans<<"\n";
    }
}

