#include <bits/stdc++.h>
using namespace std;
long long n, d[200005], sum, x, m;
bool check(long long a) {
  x = 0;
  sum = 0;
  for (int i = 1; i <= n; i++) {
    sum += max(d[i] - x, (long long)0);
    if (i % a == 0) {
      x++;
    }
  }
  if (sum >= m) {
    return false;
  }
  return true;
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> d[i];
    sum += d[i];
  }
  if (sum < m) {
    cout << -1 << endl;
    return 0;
  }
  sort(d + 1, d + n + 1);
  reverse(d + 1, d + n + 1);
  int l = 1, r = n;
  while (l < r) {
    int mid = (l + r) / 2;
    if (check(mid) == false) {
      r = mid;
    } else
      l = mid + 1;
  }
  cout << l << endl;
}
