#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int n, m;
int a[100010];
bool check(int d)
{
int sum = 0;
for(int i = 0; i < n / d; i ++)
for(int j = 1; j <= d; j ++)
sum += max(0, a[i * d + j] - i);
int t = n / d;
for(int j = 1; j <= n % d; j ++)
sum += max(0, a[t * d + j] - t);
return sum >= m;
}
int main()
{
cin >> n >> m;
for(int i = 1; i <= n; i ++) cin >> a[i];
sort(a + 1, a + n + 1, greater<int>());
int l = 1, r = n;
while(l < r)
{
int mid = l + r >> 1;
if(check(mid)) r = mid;
else l = mid + 1;
}
cout << l << endl;
}