#include <bits/stdc++.h>
#pragma GCC optimize(3)
#pragma GCC optimize(2)
using namespace std;
const int N = 2e5 + 7;
int n;
long long m;
long long a[N];
bool judge(int k) {
  long long sum = 0;
  int x = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i] <= x) break;
    sum += (a[i] - x);
    if (i % k == 0) x++;
  }
  return sum >= m;
}
inline bool cmp(int a, int b) { return a > b; }
int main() {
  ios::sync_with_stdio(false);
  ;
  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";
    return 0;
  }
  sort(a + 1, a + n + 1, cmp);
  long long l = 1, r = m;
  long long mid;
  while (l < r) {
    mid = (l + r) / 2;
    if (judge(mid))
      r = mid;
    else
      l = mid + 1;
  }
  cout << l;
  return 0;
}
