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

T=int(input())
a=[]
for case in range(T):
    n,k,m=map(int,input().split())
    a=list(map(int,input().split()))
    a.sort()
    s=sum(a[0:k])
    if s-n<=0:
        print(0)
    else:
        print(s-n)