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: 309ms
Memory: 25320kB
Author: 13373882502
In contest: 1300

t=int(input())
for i1 in range(t):
    n,k,m=map(int,input().split())
    lst=list(map(int,input().split()))
    lst.sort()
    total=0
    for i3 in range(k):
        total=total+lst[i3]
    jq=total-n
    if jq<=0:
        print("0")
    else:
        print(jq)