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: 326ms
Memory: 25328kB
Author: 13806858827
In contest: 1296

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