#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N = 212345;
int n, m;
int v[N];
bool check(int x) {
  int cnt = 0, ret = 0;
  for (int i = 0; i < n; i++) {
    ret += max(0, v[i] - cnt);
    if (i % x == x - 1) cnt++;
  }
  return ret >= m;
}
int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> v[i];
  sort(v, v + n);
  reverse(v, v + n);
  int l = 1;
  int h = 1000000001;
  while (l < h) {
    int mid = (l + h) / 2;
    if (check(mid)) {
      h = mid;
    } else {
      l = mid + 1;
    }
  }
  if (h == 1000000001)
    cout << -1 << endl;
  else
    cout << l << endl;
  return 0;
}
