t=int(input())
for _ in range(t):
    inf=400
    inf1=300
    n,m=map(int,input().split())
    A=[0]+list(map(int,input().split()))
    dp=[[[0]*inf for _ in range(inf)] for _ in range(m+1)]
    dp[0][0][0]=1
    for i in range(1,m+1):
        for a in range(-inf1,inf1):
            for b in range(-inf1,inf1):
                dp[i][a][b]=max(dp[i-1][A[i]-a][b],dp[i-1][a][A[i]-b])
    z=0
    for a in range(-inf1,inf1):
        for b in range(-inf1,inf1):
            if dp[-1][a][b]==1:
                z=max(z,a+b)
    print(z)
            