#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int n, m, a[N];
bool check(int x) {
  long long sum = 0;
  for (int i = 1, t = 0; i <= n; i++) {
    sum += a[i] - t;
    if (i % x == 0) {
      t++;
    }
    if (a[i] <= t) {
      break;
    }
  }
  return sum >= m;
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  sort(a + 1, a + n + 1, greater<int>());
  int l = 1, r = N, ans = 1 << 30;
  while (l <= r) {
    int mid = (l + r) / 2;
    if (check(mid)) {
      r = mid - 1;
      ans = min(ans, mid);
    } else {
      l = mid + 1;
    }
  }
  if (ans != 1 << 30) {
    cout << ans << endl;
  } else {
    cout << -1 << endl;
  }
  return 0;
}
