HZNUOJ


Problem_ID: A
Result: Accepted
Time: 287ms
Memory: 25316kB
Author: 13958745020
In contest: 1300

for i in range(int(input())):
    n,k,m=map(int,input().split())
    lst=list(map(int,input().split()))
    lst.sort()
    money=sum(lst[:k])
    print(0 if n>=money else money-n)