#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 1;
int n;
long long res, m, a[N];
bool Check(int x) {
  long long sum = 0;
  int cnt = 0;
  long long r = 0;
  for (int i = 1; i <= n; i++) {
    cnt++;
    sum += max((long long)0, a[i] - r);
    if (cnt == x) {
      cnt = 0;
      r++;
    }
  }
  return sum >= m;
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + 1 + n);
  reverse(a + 1, a + 1 + n);
  res = -1;
  int l = 1, r = n;
  while (l <= r) {
    int m = (l + r) / 2;
    if (Check(m)) {
      res = m;
      r = m - 1;
    } else
      l = m + 1;
  }
  cout << res;
}
