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