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