#include <bits/stdc++.h>
using namespace std;
long long int infor[200010], n, i, l, r, m, all, page, sum;
int main() {
  ios::sync_with_stdio(0);
  cin >> n >> all;
  for (i = 0; i < n; i++) {
    cin >> infor[i];
    sum += infor[i];
  }
  if (sum < all) {
    cout << -1;
    return 0;
  }
  sort(infor, infor + n);
  l = 1;
  r = n + 1;
  while (r - l > 1) {
    page = 0;
    bool flag = false;
    m = (r + l) / 2;
    int d = m, now = 1;
    for (i = n - 1; i >= 0; i--) {
      if (d <= 1) {
        d = m;
        now++;
      }
      page += (infor[i] - now + 1);
      if (page >= all) {
        flag = true;
        break;
      }
      d--;
    }
    if (flag)
      r = m;
    else
      l = m;
  }
  cout << l;
  return 0;
}
