#include <bits/stdc++.h>
using namespace std;
const int maxN = 2e5 + 10;
int n;
long long m, a[maxN];
int chk(int u) {
  long long sum = 0;
  for (int i = 1; i <= n; ++i) sum += max(0ll, a[i] - (i - 1) / u);
  return sum < m;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  sort(a + 1, a + n + 1, greater<long long>());
  int low = 1;
  int hig = n;
  int mid;
  while (low <= hig) {
    mid = (low + hig) / 2;
    if (chk(mid))
      low = mid + 1;
    else
      hig = mid - 1;
  }
  if (low == n + 1) low = -1;
  cout << low;
}
