#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int siz = 2e5 + 5;
long long n, m, a[siz];
bool is_ok(int d) {
  long long cur = 0, z = 0;
  for (int i = 1; i <= n; i++) {
    cur += max(0LL, a[i] - z);
    if (i % d == 0) z++;
  }
  return cur >= m;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + 1 + n);
  reverse(a + 1, a + 1 + n);
  long long x = 0;
  for (int i = 1; i <= n; i++) x += a[i];
  if (x < m) return cout << -1, 0;
  int l = 1, r = n, ans = n;
  while (l <= r) {
    int mid = l + (r - l) / 2;
    if (is_ok(mid)) {
      ans = mid;
      r = mid - 1;
    } else
      l = mid + 1;
  }
  cout << ans << endl;
}
