#include <bits/stdc++.h>
using namespace std;
long long mM(long long a, long long b, long long mod) {
  long long res = 0;
  a %= mod;
  while (b) {
    if (b & 1) res = (res + a) % mod;
    a = (2 * a) % mod;
    b >>= 1;
  }
  return res;
}
long long fpow(long long first, long long second, long long p) {
  first = first % p;
  long long res = 1;
  while (second) {
    if (second & 1) res = (res * first) % p;
    res %= p;
    if (res < 0) res = (res + p) % p;
    second = second >> 1;
    first = (first * first) % p;
    if (first < 0) first = (first + p) % p;
    first %= p;
  }
  return res;
}
long long inv(long long n, long long p) { return fpow(n, p - 2, p); }
long long modmul(long long first, long long second) {
  return (first * second) % 1000000007;
}
long long modadd(long long first, long long second) {
  if (first >= 1000000007) first -= 1000000007;
  if (second >= 1000000007) second -= 1000000007;
  long long temp = first + second;
  if (temp >= 1000000007) temp -= 1000000007;
  if (temp < 0) temp = temp + 1000000007;
  return temp;
}
long long n, m;
vector<long long> a(200005);
bool fun(long long mid) {
  long long ans = 0;
  long long cnt = 0, ind = 0;
  long long gr = n / mid;
  for (int i = 0; i < gr; i++, cnt++)
    for (int j = 0; j < mid; j++, ind++) ans += max(0LL, a[ind] - cnt);
  for (; ind < n; ind++) ans += max(0LL, a[ind] - cnt);
  if (ans >= m) return true;
  return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) {
    cin >> n >> m;
    for (int i = 0; i < n; i++) cin >> a[i];
    sort(a.rbegin(), a.rend());
    long long l = 1, r = n;
    while (l < r) {
      long long mid = (l + r) / 2;
      if (fun(mid))
        r = mid;
      else
        l = mid + 1;
    }
    if (fun(l))
      cout << l << "\n";
    else
      cout << "-1\n";
  }
}
