class Solution:
def ratCat(self, n, k ,arr):
arr.sort()
cat = 0
pos = len(arr) - 1
ans = 0
while pos>-1 and cat < arr[pos]:
cat+= n - arr[pos]
pos-=1
ans+=1
return ans
obj = Solution()
t = int(input())
for _ in range(t):
n, k = list(map(int, input().split()))
arr = list(map(int, input().split()))
print(obj.ratCat(n, k, arr))
/// In the name of Allah
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define nl '\n'
typedef long long ll;
int dx[] = {0, 0, +1, -1};
int dy[] = {+1, -1, 0, 0};
const int MX = 1e5+123;
void solve( )
{
ll n,k;
cin>>n>>k;
vector<ll>v(k);
for(ll i=0;i<k;i++)
{
cin>>v[i];
}
sort(v.rbegin(),v.rend());
ll cat=0,cnt=0;
cnt=0;
for(ll i=0;i<k;i++)
{
if(v[i]>cat)
{
cat+=(n-v[i]);
cnt++;
}
else break;
}
cout<<cnt<<nl;
}
int main()
{
fast
ll T;
cin>>T;
for(ll t=1;t<=T;t++)
{
solve();
}
return 0;
}
349B - Color the Fence | 144A - Arrival of the General |
1106A - Lunar New Year and Cross Counting | 58A - Chat room |
230A - Dragons | 200B - Drinks |
13A - Numbers | 129A - Cookies |
1367B - Even Array | 136A - Presents |
1450A - Avoid Trygub | 327A - Flipping Game |
411A - Password Check | 1520C - Not Adjacent Matrix |
1538B - Friends and Candies | 580A - Kefa and First Steps |
1038B - Non-Coprime Partition | 43A - Football |
50A - Domino piling | 479A - Expression |
1480A - Yet Another String Game | 1216C - White Sheet |
1648A - Weird Sum | 427A - Police Recruits |
535A - Tavas and Nafas | 581A - Vasya the Hipster |
1537B - Bad Boy | 1406B - Maximum Product |
507B - Amr and Pins | 379A - New Year Candles |