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: 305ms
Memory: 25312kB
Author: 13758494551
In contest: 1300

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