#include <bits/stdc++.h>
using namespace std;
void cline() { cout << '\n'; }
template <typename T, typename... V>
void cline(T t, V... v) {
  cout << t;
  if (sizeof...(v)) cout << ' ';
  cline(v...);
}
void cspc() { cout << ' '; }
template <typename T, typename... V>
void cspc(T t, V... v) {
  cout << t;
  if (sizeof...(v)) cout << ' ';
  cspc(v...);
}
const long long N = 1e6;
long long n, val;
long long a[N];
long long sum;
bool check(long long len) {
  long long som = 0;
  long long dec = 0;
  for (long long i = 1; i <= n; i++) {
    if (a[i] - dec < 0) {
      break;
    }
    som += a[i] - dec;
    if (i % len == 0) {
      dec++;
    }
  }
  if (som >= val)
    return 1;
  else
    return 0;
}
long long binsrch(long long low, long long high) {
  long long mid;
  while (low < high) {
    mid = low + (high - low) / 2;
    if (check(mid))
      high = mid;
    else
      low = mid + 1;
  }
  if (check(high)) {
    return high;
  } else {
    return -1;
  }
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> val;
  sum = 0;
  for (long long i = 1; i <= n; i++) cin >> a[i], sum += a[i];
  sort(a + 1, a + n + 1, greater<long long>());
  if (sum < val) {
    cspc("-1");
    return 0;
  }
  cspc(binsrch(1, n));
  return 0;
}
