HZNUOJ


Problem_ID: A
Result: Accepted
Time: 277ms
Memory: 25316kB
Author: 18069821833
In contest: 1300

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