#include<iostream>
#include<vector>
#define ll long long
using namespace std;
int n, w;
int a[500005];
int num[15];
int maxn;
int dp[15][500005];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n >> w;
for (int i = 1; i <= n; i++) {
cin >> a[i];
num[a[i]]++;
maxn = max(maxn, a[i]);
}
int cnt = 0;
vector<int> nn;
nn.push_back(0);
for (int i = 1; i <= maxn; i++) {
if (num[i])nn.push_back(num[i]);
}
int ans = 0;
maxn = nn.size() - 1;
// cout<<maxn<<"?";
while (cnt <= maxn) {
ans++;
int now = maxn - cnt;
memset(dp, 0, sizeof(dp));
for (int i = 1; i <= now; i++) {
for (int j = w; j >= 1; j--) {
if (j >= nn[i]) {
dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - nn[i]] + 1);
}
else {
dp[i][j] = dp[i - 1][j];
}
}
}
int j = w;
vector<int> tp;
for (int i = now; i >= 1; i--) {
if (dp[i][j] != dp[i - 1][j]) {
tp.push_back(i);
j = j - nn[i];
}
}
for (int i = 0; i < tp.size(); i++) {
nn.erase(nn.begin() + tp[i], nn.begin() + tp[i] + 1);
}
cnt += tp.size();
}
cout << ans << "\n";
return 0;
}