#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<int> v;
bool check(int p) {
  int i, s = 0;
  for (i = 0; i < n; i++) {
    s = s + max(0, v[i] - i / p);
    if (s >= m) {
      return true;
    }
  }
  return false;
}
int binary_search(int low, int high) {
  int mid;
  while (high - low > 2) {
    mid = (high + low) / 2;
    if (check(mid)) {
      high = mid;
    } else {
      low = mid + 1;
    }
  }
  for (mid = low; mid <= high; mid++) {
    if (check(mid)) {
      return mid;
    }
  }
}
int main() {
  bool b = false;
  int i, p, s = 0;
  cin >> n >> m;
  for (i = 0; i < n; i++) {
    cin >> p;
    v.push_back(p);
    s = s + p;
    if (s >= m) {
      b = true;
    }
  }
  if (b == false) {
    cout << '-' << '1';
    return 0;
  }
  sort(v.rbegin(), v.rend());
  cout << binary_search(1, n);
  return 0;
}
