
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define int ll
#define mod 1000000007
#define modf -1
#define all(a) a.begin(), a.end()
#define infl 1000000000000000009
#define inf 1000000009


signed main()
{
#ifdef LOCAL
    FILE* stream1; freopen_s(&stream1, "input.txt", "r", stdin);
#else
    cin.tie(); cout.tie(); ios::sync_with_stdio(0);
#endif
    //ull st = clock();
    //*****************************
    int t;
    cin >>t;
    for(int uuu = 0;uuu < t;uuu++)
    {
        int n,m;
        cin >>n>>m;
        vector<int> x(m);
        for(int &i : x)
            cin >>i;
        int ans = 0;
        ans += min(n,m) * x[0];
        for(int i = n;i < m;i++)
        {
            if((i-n) % 2 == 0)
                ans -= x[0];
            else
                ans += x[0];
        }
        cout <<ans<<"\n";

//        reverse(all(x));
//        vector<vector<int>>dp(m+1,vector<int>(n+1,-infl));
//        dp[0][n] = 0;
//        for(int i = 1;i <= m;i++)
//        {
//            dp[i][n] = dp[i-1][n-1] - x[i-1];
//            dp[i][0] = dp[i-1][1] + x[i-1];
//            for(int j = 1;j < n;j++)
//                dp[i][j] = max(dp[i-1][j+1] + x[i-1],dp[i-1][j-1] - x[i-1]);
//        }
//        int ans = dp[m][0];
//        for(int i= 1;i <= n;i++)
//            ans = max(ans,dp[m][i]);
//        cout <<ans<<"\n";
    }
    //*****************************
    //ull end = clock();
    //cout <<(end-st);
}