#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
long long n, m, a[200005];
bool cmp(long long a, long long b) { return a > b; }
bool check(long long x) {
  long long cnt = 0, tot = 0, tmp = 0;
  for (long long i = 1; i <= n; i++) {
    tot += max((long long)0, a[i] - cnt);
    if (tot >= m) return 1;
    tmp++;
    if (tmp == x) {
      tmp = 0;
      cnt++;
    }
  }
  return 0;
}
int main() {
  cin >> n >> m;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + 1 + n, cmp);
  long long l = 1, r = n, mid, ans = -1;
  while (l <= r) {
    mid = l + r >> 1;
    if (check(mid)) {
      ans = mid;
      r = ans - 1;
    } else
      l = mid + 1;
  }
  cout << ans;
  return 0;
}
