HZNUOJ


Problem_ID: A
Result: Accepted
Time: 286ms
Memory: 25328kB
Author: 18358633132
In contest: 1296

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