#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ll MOD = 998244353;
const ll MAX = 2e5 + 1;
inline ll add(ll a, ll b) { return ((a % mod) + (b % mod)) % mod; }
inline ll sub(ll a, ll b) { return ((a % mod) - (b % mod) + mod) % mod; }
inline ll mul(ll a, ll b) { return ((a % mod) * (b % mod)) % mod; }
ll pwr(ll x, ll n) {
  if (!n) return 1;
  if (n & 1)
    return mul(x, pwr(mul(x, x), (n - 1) / 2));
  else
    return pwr(mul(x, x), n / 2);
}
ll modinv(ll n) { return pwr(n, mod - 2); }
ll n, a[MAX], m;
bool possible(ll mid) {
  ll sum = 0;
  for (ll i = 0; i < mid; i++) {
    ll day = 0;
    for (ll j = i; j < n; j += mid) {
      sum += max(0LL, a[j] - day);
      day++;
    }
  }
  if (sum >= m) {
    return true;
  }
  return false;
}
void speed_solve() {
  cin >> n >> m;
  for (ll i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  reverse(a, a + n);
  ll lo = 1, hi = n, mid, ans = inf;
  while (lo <= hi) {
    mid = lo + (hi - lo) / 2;
    if (possible(mid)) {
      hi = mid - 1;
      ans = min(ans, mid);
    } else {
      lo = mid + 1;
    }
  }
  if (ans == inf) {
    ans = -1;
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ll test_cases = 1;
  for (ll i = 0; i < test_cases; i++) {
    speed_solve();
  }
  return 0;
}
