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: 298ms
Memory: 25316kB
Author: 13867179686
In contest: 1300

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