### My issue

### My code

```
#include <bits/stdc++.h>
using namespace std;
int main() {
int T;
cin >> T;
while (T--) {
int N, M;
cin >> N >> M;
vector<int> balls(M);
for (int i = 0; i < M; i++) {
cin >> balls[i];
}
sort(balls.rbegin(), balls.rend()); // Sort in non-decreasing order
int minBoxes = INT_MAX;
int excess = 0;
for (int i = 0; i < M; i++) {
int diff = balls[i] - M;
excess += diff;
if (excess < 0) {
excess = 0;
}
int boxes = (excess + M - 1) / M; // Calculate the number of boxes with M balls
minBoxes = min(minBoxes, boxes + i + 1); // Update the minimum number of boxes
}
cout << minBoxes << endl;
}
return 0;
}
```

Problem Link: BLDST Problem - CodeChef