#include using namespace std; #define ll long long #define rep(i, n) for (int i = 0; i < (int)(n); i++) template bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;} template bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;} const long long mod=998244353; const long long mod2=469762049; const long long mod100=1000000007; int main(){ cout.tie()->sync_with_stdio(0); cin.tie(0); int N;ll S;cin>>N>>S; ll A[N+1]; for(int i=1;i<=N;i++) cin>>A[i]; vectordat; ll ans=0; for(int i=1;i<=N;i++){ if(A[i]>=S){ ans+=A[i]; } else{ dat.push_back(A[i]); } } vectordat2; int l=1,r=N+1; while(l!=r){ int m=(l+r)/2; dat2.clear(); for(auto p:dat){ if(p>m) dat2.push_back(p); } sort(dat2.rbegin(),dat2.rend()); int cnt=m; ll cost=0; for(auto p:dat2){ if(cnt==m){ cnt=0; cost+=p; } cnt++; } if(cost