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: 304ms
Memory: 25316kB
Author: 13600513276
In contest: 1296

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