t=int(input()) for tcase in range(t): n,k,m=map(int,input().split()) a=list(map(int,input().split())) a.sort() s=sum(a[0:k]) if n-s<0: print(s-n) else: print(0)