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