#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
long long a[maxn];
long long sum[maxn];
priority_queue<int> q;
bool cmp(long long a, long long b) { return a > b; }
int main() {
  ios::sync_with_stdio(false);
  long long m;
  int n;
  long long summ = 0;
  memset(sum, 0, sizeof(sum));
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    summ += a[i];
  }
  if (summ < m) {
    cout << -1 << endl;
    return 0;
  }
  sort(a + 1, a + n + 1, cmp);
  for (int i = 1; i <= n; i++) {
    sum[i] = sum[i - 1] + a[i];
  }
  int ans = n;
  long long now = 0;
  for (int i = 1; i <= n; i++) {
    int l = 1, r = i;
    while (l <= r) {
      int mid = (l + r) >> 1;
      int left = i % mid;
      now = sum[i] - ((i / mid - 1) * (i / mid) * (mid - left) / 2) -
            ((i / mid) * (i / mid + 1) * left / 2);
      if (now > m) {
        ans = min(ans, mid);
        r = mid - 1;
      } else if (now < m)
        l = mid + 1;
      else {
        ans = min(ans, mid);
        break;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
