HZNUOJ


Problem_ID: A
Result: Accepted
Time: 268ms
Memory: 25312kB
Author: 13566158000
In contest: 1296

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