Start: Jul, 06, 2019 10:00:00
20190706Python程序设计基础培训扩展练习
End: Jul, 17, 2019 12:00:00
Time elapsed:
Time remaining:

Problem_ID: A
Result: Accepted
Time: 298ms
Memory: 25328kB
Author: 18605753875
In contest: 1300

t=int(input())
for tt in range(t):
    n,k,m=map(int,input().split())
    m_list=list(map(int,input().split()))
    m_list.sort()
    s=0
    for kk in range(k):
       s+=m_list[kk]
    s=s-n
    if s>0:
        print(s)
    else:
        print(0)