Start: Jul, 06, 2019 10:00:00
20190706Python程序设计基础培训扩展练习
End: Jul, 17, 2019 12:00:00
Time elapsed:
Time remaining:

Problem_ID: A
Result: Accepted
Time: 329ms
Memory: 25316kB
Author: 13967018787
In contest: 1300

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