#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
int n, m;
int a[N];
int ans = (int)1e9 + 7;
bool Check(int sz) {
  long long cnt = 0;
  for (int j = 1; j <= n; j++) {
    if (j <= sz)
      cnt += a[j];
    else {
      if (a[j] > ((j - 1) / sz))
        cnt += a[j] - ((j - 1) / sz);
      else
        break;
    }
    if (cnt >= m) return true;
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + 1 + n);
  int l = 0, r = n + 1;
  int mid = (l + r) / 2;
  reverse(a + 1, a + 1 + n);
  while (l != mid && r != mid) {
    if (Check(mid))
      r = mid, ans = min(ans, mid);
    else
      l = mid;
    mid = (l + r) / 2;
  }
  if (ans == (int)1e9 + 7)
    cout << -1;
  else
    cout << ans;
  return 0;
}
