def f(i,Z):
    if i==m:
        return sum(Z)
    Q=list(Z)
    z=0
    for j in range(n):
        Q[j]=A[i]-Q[j]
        z=max(z,f(i+1,Q))
        Q[j]=Z[j]
    return z
        
t=int(input())
for _ in range(t):
    n,m=map(int,input().split())
    A=list(map(int,input().split()))
    print(f(0,[0]*n))
