#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const long long inf = 1e18;
const int maxn = 2e5 + 10;
const double eps = 1e-7;
const double pi = 3.14159265359;
long long n, m, a[maxn], par[maxn];
bool check(int x) {
  long long now = 0;
  long long cnt = 0;
  long long cal = 0;
  for (int i = 0; i < n; i++) {
    if (cal >= x) {
      cal = 0;
      cnt++;
    }
    if (a[i] - cnt > 0) {
      now += a[i] - cnt;
      cal++;
    }
  }
  if (now >= m) {
    return 1;
  }
  return 0;
}
int main() {
  std::ios::sync_with_stdio(0);
  ;
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  reverse(a, a + n);
  par[0] = a[0];
  for (int i = 1; i < n; i++) {
    par[i] = par[i - 1] + a[i];
  }
  int ans = -1;
  long long l = 1, r = n + 5, mid;
  while (l <= r) {
    mid = (l + r) / 2;
    if (check(mid)) {
      ans = mid;
      r = mid - 1;
    } else {
      l = mid + 1;
    }
  }
  cout << ans;
}
