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: 330ms
Memory: 25320kB
Author: 15757118136
In contest: 1296



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