1
2
3
4
5
6
7
8
9
10
11
12
13
ncase = int(raw_input())
for t in range(ncase):
ss=0
n,m,k = map(int,raw_input().strip().split())
s=map(int,raw_input().strip().split())
s.sort()
for j in range(m):
ss=ss+s[j]
cc=ss-n
if cc>0:
print cc
else:
print 0