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

Problem_ID: A
Result: Accepted
Time: 272ms
Memory: 25312kB
Author: 13600624162
In contest: 1296

#这是答案
for tcase in range(int(input())):
    n,k,m = map(int,input().split())
    money = list(map(int,input().split()))
    money.sort()
    print(sum(money[:k])-n  if sum(money[:k])>=n else 0 )