为啥0分
#define ll long long
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cmath>
using namespace std;
struct node{
ll sj;
ll xsj;
}a[1000001];
ll n,m,ans;
ll h,t;
int cmp(node a,node b){
return a.sj<=b.sj;
}
int main(){
cin>>n>>m;
for(int i=1;i<=n;i++){
cin>>a[i].sj;
}
sort(a+1,a+1+n,cmp);
// for(int i=1;i<=n;i++){
// cout<<a[i].sj<<" ";
// }cout<<endl;
h=1;t=m;
while(h<=n){
ans++;
for(int i=h;i<=t;i++){
a[i].sj--;;
if(a[i].sj==0){
//cout<<h<<" "<<ans<<endl;
h++;t++;
}
}
}
cout<<ans;
return 0;
}