#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long llinf = 0x3f3f3f3f3f3f3f3f;
template <typename INint>
inline void IN(INint &x) {
  x = 0;
  int f = 1;
  char c;
  cin.get(c);
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    cin.get(c);
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    cin.get(c);
  }
  x *= f;
}
template <typename INint>
inline void OUT(INint x) {
  if (x > 9) OUT(x / 10);
  cout.put(x % 10 + '0');
}
const int maxn = int(2e5 + 4);
int a[maxn], L[maxn];
long long n, m;
bool check(long long x) {
  long long res(0);
  long long ind(0);
  while (res < m) {
    ++ind;
    if (ind == n + 1) return 0;
    res += max(a[ind] - (ind - 1) / x, 0ll);
  }
  return 1;
}
int main() {
  int T(1), times(0);
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  while (++times, T--) {
    cin >> n >> m;
    for (int i = 1; i <= int(n); i++) cin >> a[i];
    sort(a + 1, a + 1 + n);
    reverse(a + 1, a + 1 + n);
    for (int i = 1; i <= int(n); i++) L[i] = L[i - 1] + a[i];
    long long le(0), ri(inf);
    while (le + 1 != ri) {
      long long mid = (le + ri) / 2;
      if (check(mid))
        ri = mid;
      else
        le = mid;
    }
    if (ri == inf) ri = -1;
    cout << ri << endl;
  }
  return 0;
}
